如何在PHP中实现抽象属性?

时间:2016-08-28 18:05:41

标签: php oop abstract

如何在$myVar中提取ParentClass摘要?

<?php
abstract class ParentClass
{
    public $myVar;  //Make this abstract

    abstract public function get();

    public function someMethod() {}
}

class childClass extends ParentClass
{
    public $myVar = 123;

    public function get(){}

    public function someOtherMethod() {}
}

0 个答案:

没有答案