モナーの *やさしい* Delphi質問スレ Ver4
■ このスレッドは過去ログ倉庫に格納されています
0291デフォルトの名無しさん
NGNG以下のようにしたのですが…
このあとどういう風にすれば Decorator パターンになりますか?
type
TInstrument = class
procedure Play; virtual; abstract;
end;
TGuiter = class( TInstrument )
procedure Play; override;
end;
TEffector = class( TInstrument )
FInstrument: TInstrument;
procedure Play; override;
end;
TEffector1 = class( TEffector );
procedure Play; override;
end;
TEffector2 = class( TEffector );
procedure Play; override;
end;
TEffector3 = class( TEffector );
procedure Play; override;
end;
procedure TGuiter.Play; begin WriteLn('ビヨン..'); end;
procedure TEffector1.Play; begin FInstrument.Play; WriteLn('ョンョンョン...'); end;
procedure TEffector2.Play; begin FInstrument.Play; WriteLn('ボワワンボワワン'); end;
procedure TEffector3.Play; begin FInstrument.Play; WriteLn('キィーン'); end;
■ このスレッドは過去ログ倉庫に格納されています