0

我是扩展类的新手,遇到了一些问题。我试图通过使用与构造不同的函数来启动变量。如果你往下看,它应该更有意义。

class A
{
    private static $_var;

    function __construct($EGGS)
    {
        $this->_var=$EGGS
    }

    private static function _ini()
    {
        $this->_var="hard coded value";
    }
}

class B extends A
{
     //How do I initiate private static $_var with the _ini() instead of using
     //the __construct here in good old class B?
}

$a = new A("foo");//works just fine
$b = new B;
4

0 回答 0