Re: php5 and objects

From: Date: Wed, 28 Jul 2004 20:09:17 +0000
Subject: Re: php5 and objects
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192125@lists.php.net to get a copy of this message
* Thus wrote Krzysztof Gorzelak: > // start of code > abstract class Strona { > > abstract public function generuj_strone(); > > function foo() { > generuj_strone(); > } > } > > class Katalog extends Strona { > public function generuj_strone() { > echo "OK"; > } > > } > > $bar = new Katalog(); > $bar->foo(); > // end of code > And I get such error : > Fatal error: Cannot call abstract method Strona::generuj_strone() in .... > > And I expect word: OK > Is it a bug or a normal behaviour ? It may be a bug, but not in the sense as your probably think. The error message should be complaining about an undefined function instead of trying to access self::generuj_strone() In foo() use: $this->generuj_strone(); That will make things work properly Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#192125) next »