我学习PHP,遇到问题:
<?php
class ProtectVis
{
abstract protected function countMoney();
protected $wage;
protected function setHourly($hourly)
{
$money = $hourly;
return $money;
}
}
class ConcreteProtect extends ProtectVis
{
function __construct()
{
$this->countMoney();
}
protected function countMoney()
{
echo "ok";
}
}
$worker = new ConcreteProtect();
Run Code Online (Sandbox Code Playgroud)
现在我有错误:
致命错误:类 ProtectVis 包含 1 个抽象方法,因此必须将其声明为抽象方法或实现以下中的其余方法 (ProtectVis::countMoney)
为什么?