<?php
class People{
public function walk(){
echo "步行....";
}
function say(){
echo "说话<br/>";
}
}
trait Woman{
public function eat(){
echo "女人吃饭<br/>";
}
public function dance(){
echo "女人跳舞<br/>";
}
}
trait Man{
public function walk(){
parent::walk();
echo "继续步行...<br/>";
}
public function say(){
echo "男人说话<br/>";
}
public function sing(){
echo "男人唱歌<br/>";
}
}
class Child extends People{
use Man,Woman;
public function sing(){
echo "小孩唱歌<br/>";
}
public function dance(){
echo "小孩跳舞<br/>";
}
}
$obj=new Child();
$obj->walk();
$obj->eat();
$obj->say();
$obj->sing();
$obj->dance();