note 56345 rejected from language.oop5.static by betz
| From: | betz@php.net | Date: | Tue, 06 Sep 2005 09:43:52 +0000 |
| Subject: | note 56345 rejected from language.oop5.static by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-94801@lists.php.net to get a copy of this message | ||
Note Submitter: cbelin at free dot fr
----
Manual says that static members and methods cannot be redefined in subclasses.
It seems that it's not completely true (at least with PHP 5.0.4 under Windows XP), as
redefining static methods in subclasses is allowed, and works fine (i.e. without triggering errors
even if error level includes E_STRICT).
Here is an example :
class Base
{
public static function foo()
{
return 'Foo...';
}
}
class Extended extends Base
{
public static function foo()
{
return 'Bar !!!';
}
}
echo Extended::foo();
// this prints 'Bar !!!' instead of 'Foo...'