duansha7025 2012-10-02 22:52
浏览 57
已采纳

你如何通过子类调用构造函数?

I need to call the constructor of the following class Foto

class Foto extends Galerie
{
    function __construct($a,$b)
    { }
}

via its child class. Something like:

class Album extends Foto
{
    function __construct($a,$b)
    { return $this->Foto[__construct] }
}

Any ideas? Hope you'll get my point.

  • 写回答

2条回答 默认 最新

  • doubinchou4219 2012-10-02 23:02
    关注
    parent::__construct($a,$b)
    

    Is what you're looking for. You can also call parent class methods utilizing the same keyword.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?