所以,我有以下问题:
我有这个抽象类的多个孩子的抽象类。
在我看来,最好的解释是一个例子:
abstract class AbstractClass
{
public $varialbe = false;
abstract function process();
}
class Child1 extends AbstractClass
{
public function process()
{
//some code here
}
}
class Child2 extends AbstractClass
{
public function process()
{
//!!!Problem is here = Fatal error: Cannot instantiate abstract class AbstractClass
$child1 = new Child1();
//I need something like this:
$child1->varialbe = $this->variable;
$child1->process();
}
}
$child2 = new Child2();
$child2->process();
感谢帮助!