class BaseArt{ protected $content; protected $art = null; public function __construct($content){ $this->content = $content; } public function decorator(){ return $this->content; } } class BianArt extends BaseArt{ public function __construct(BaseArt $art){ $this->art = $art; $this->decorator(); } public function decorator(){ return $this->content = $this->art->decorator()."不不不不不"; } } class SeoArt extends BaseArt{ public function __construct(BaseArt $art){ $this->art = $art; $this->decorator(); } public function decorator(){ return $this->content = $this->art->decorator()."kkk"; } } $a =new SeoArt(new BianArt(new BaseArt("斤斤计较"))); echo $a->decorator();
09-10
09-10