public function getText() { return $this->textString; } public function setText($str) { $this->textString = $str; } } 先程のクラスと一緒。 インターフェイスに対する 実装クラスになった。 Decoratorパターン
public function __construct(Text $target) { $this->text = $target; } public function getText() { return $this->text->getText(); } public function setText($str) { $this->text->setText($str); } } Decoratorクラスを作る。 コードの遊び部分になる。 Decoratorパターン