Re: Classes and parents.

From: Date: Sat, 22 Jan 2005 03:56:30 +0000
Subject: Re: Classes and parents.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-207029@lists.php.net to get a copy of this message
the run function in b overrides the run function in a, thats why it echo's "B" On Fri, 2005-01-21 at 18:37, Dmitry wrote: > Greetings. > > If i run this code (php5): > ------------------------------------------ > class a { > function say() { echo "A"; } > function run() { $this->say(); } > } > class b extends a { > function say() { echo "B"; } > function run() { parent::run(); } > } > > $obj = new b; > $obj->run(); > --------------------------------------- > > I will get "B", but how i may get "A"? -- Regards, Matthew Fonda

« previous php.general (#207029) next »