NYCPHP Meetup

NYPHP.org

[nycphp-talk] static methods in derived classes

David Sklar sklar at sklar.com
Thu Sep 23 11:19:07 EDT 2004


Adam Maccabee Trachtenberg wrote:
> On Thu, 23 Sep 2004, David Sklar wrote:
> 
> 
>>I think the bug that Joseph posted is the definitive answer here -- it's
>>a design decision/limitation in the way self:: works in the engine.
> 
> 
> Generally, from my poking around with PHP 5, when a method is declared
> static, you cannot reference anything that requires an object
> instance. (Unless, of course, you pass that object into the method.)
> 
> The assumption is you should be allowed to directly call Meal::eat()
> and have it work without instantiating an instance of Meal, and that
> condition would fail if you're allowed to reference methods
> solely implemented in a child class.

Yeah, I was hoping for an exception since the child methods are static, too.

David





More information about the talk mailing list