<?php
//抽象类存在的目的是被继承,而不是用来被实现
abstract class wenwajiao
{
//抽象类中一定要有抽象方法,而且一定要被实现
abstract public function hoaring();
}
abstract class bwt extends wenwajiao
{
public function hoaring()
{
echo "吼吼~哈哈~";
}
abstract public function introduce($name,$age,$from);
}
class coach extends bwt
{
public function hoaring()
{
echo "嗷儿喂~嗷儿喂~"."
";
}
public function introduce($name, $age, $from)
{
echo "大家好 ".$name." 今年 ".$age." 来自 ".$from."
";
}
}
$cpc = new coach();
$cpc->hoaring();
$cpc->introduce('陈培昌',21,'北武堂');
?>
输出结果:
嗷儿喂~嗷儿喂~
大家好 陈培昌 今年 21 来自 北武堂