Bug #1333: calls to parent methods would be handy

From: Date: Tue, 20 Apr 1999 14:51:26 +0000
Subject: Bug #1333: calls to parent methods would be handy
Groups: php.dev 
Request: Send a blank email to php-dev+get-5153@lists.php.net to get a copy of this message
From: maarnold@gte.net Operating system: linux PHP version: 3.0.5 PHP Bug Type: Feature/Change Request Bug description: calls to parent methods would be handy It would be nice if a derived class could, within an overridden method, call the method of the same name in the parent class. For example ... class DbTblC { var $id; var $othervar; function DbTblC() { $this->RReset(); } // function DbTblC() function RReset() { $this->id=0; $othervar = ""; } function RReset() } // class DbTblC class AuthTblC extends DbTblC { function RReset() { $parent->RReset(); $this->id = md5(uniqueid(random())); } // function RReset() } // class AuthTblC What I have done as a work around is rename the RReset() function to RResetFields() and then stubbed the RReset() function to do nothing more than call RResetFields()... class DbTblC { ... RResetFields() { $this->id=0; Rthis->othervar=""; } RReset() { $this->ResetFields(); } } Then the derived class can override RReset() with... function RReset() { $this->RResetFields(); $this->id=md5(uniqueid(random))); } This might work, but it rather loses some of the poetry of object oriented programming. -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#5153) next »