Re: Calling parent's constructor

From: Date: Wed, 13 Dec 2000 21:59:19 +0000
Subject: Re: Calling parent's constructor
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-41228@lists.php.net to get a copy of this message
On Wed, 13 Dec 2000, Andrei Zmievski wrote: > 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. > Does get_parent_class() work for you? -- Ignacio Vazquez-Abrams <ignacio@openservices.net>

« previous php.dev (#41228) next »