Class inheritance in PHP 5.2: Overriding static variable in extension class?

后端 未结 3 1459
眼角桃花
眼角桃花 2021-02-20 02:53

I need to bea be able to use a static variable set in a class that extends a base class... from the base class.

Consider this:

class Animal {
    public          


        
3条回答
  •  没有蜡笔的小新
    2021-02-20 03:26

    Sadly, before PHP 5.3 there's no way to simulate late static binding. The only way you can get the inheritance to work as you intend is if those are instance variables and methods.

提交回复
热议问题