name = $name; } public function Show() { echo "装扮的{$this->name}"; }}/** * 服饰类 * @author wangdk * */class Finery extends Person { protected $component; public function __construct($component) { $this->component = $component; } public function Show() { if ($this->component) { $this->component->Show(); } }}class TShirts extends Finery { public function Show() { echo '大体恤!'; parent::Show(); }}class BigTrouser extends Finery{ public function Show() { echo '垮裤'; parent::Show(); }}$obj = new Person('小王');$t = new TShirts($obj);$b = new BigTrouser($t);$b->Show();?>