note 30106 added to keyword.parent

From: Date: Thu, 06 Mar 2003 14:46:22 +0000
Subject: note 30106 added to keyword.parent
Groups: php.notes 
Request: Send a blank email to php-notes+get-44943@lists.php.net to get a copy of this message
If you like Java and you have to call parent constructor, this is my method: class object { function super() { $par = get_parent_class($this); $this->$par(); } } class A extends object { function A() { echo "A constructor\n"; } } class B extends A { function B() { $this->super(); echo "B constructor\n"; } } Include the classes above, instance a new B class and this is the output: A constructor B constructor In your web application every class will extend the object class. Good luck, Emanuele :) -- http://www.php.net/manual/en/keyword.parent.php http://master.php.net/manage/user-notes.php?action=edit+30106 http://master.php.net/manage/user-notes.php?action=delete+30106 http://master.php.net/manage/user-notes.php?action=reject+30106

« previous php.notes (#44943) next »