Calling parent's constructor

From: Date: Wed, 13 Dec 2000 21:56:12 +0000
Subject: Calling parent's constructor
Groups: php.dev 
Request: Send a blank email to php-dev+get-41227@lists.php.net to get a copy of this message
Just stumbled upon something while writing a script. Is it possible to call parent's constructor without knowing parent class's name? Example: class Foo { function Foo() { print "foo"; } } class Bar extends Foo { function Bar() { parent::Foo(); print "bar"; } } Of course, some will say that since Bar is known to extend Foo, then just use Foo::Foo(), but we've had this discussion before and that's why "parent" construct was introduced. Maybe we could have "parent::parent()"? -Andrei Hacker: Any person who derives joy from discovering ways to circumvent limitations.

« previous php.dev (#41227) next »