note 25372 added to ref.classobj

From: Date: Fri, 20 Sep 2002 19:52:28 +0000
Subject: note 25372 added to ref.classobj
Groups: php.notes 
Request: Send a blank email to php-notes+get-37067@lists.php.net to get a copy of this message
Something I found out just now that comes in very handy for my current project: it is possible to have a class override itself in any method ( including the constructor ) like this: class a { ..function ha ( ) { ....if ( $some_expr ) { ......$this = new b; ......return $this->ha ( ); ....} ....return $something; ..} } in this case assuming that class b is already defined and also has the method ha ( ) note that the code after the statement to override itself is still executed but now applies to the new class i did not find any information about this behaviour anywhere, so i have no clue wether this is supposed to be like this and if it might change... but it opens a few possibilities in flexible scripting!! -- http://www.php.net/manual/en/ref.classobj.php http://master.php.net/manage/user-notes.php?action=edit+25372 http://master.php.net/manage/user-notes.php?action=delete+25372 http://master.php.net/manage/user-notes.php?action=reject+25372

« previous php.notes (#37067) next »