|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-04-20 15:40 UTC] andi
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Jun 17 19:00:01 2026 UTC |
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.