<?php
abstract class Phone{
final public function run(){
$this->powerOn();
$this->showLogo();
$this->callUp();
}
protected function powerOn(){
echo '开机'.'<br>';
}
abstract protected function showLogo();
protected function callUp(){
echo '打电话'.'<br>';
}
}
class XiaoMi extends Phone{
protected function showLogo()
{
// TODO: Implement showLogo() method.
echo '小米'.'<br>';
}
}
class Index{
public function run(){
$xiaomi=new XiaoMi();
$xiaomi->run();
}
}
$client=new Index();
$client->run();

被折叠的 条评论
为什么被折叠?



