NYCPHP Meetup

NYPHP.org

[nycphp-talk] static methods in derived classes

Adam Maccabee Trachtenberg adam at trachtenberg.com
Thu Sep 23 10:57:15 EDT 2004


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.

-adam

-- 
adam at trachtenberg.com
author of o'reilly's "upgrading to php 5" and "php cookbook"
avoid the holiday rush, buy your copies today!



More information about the talk mailing list