·
· { TRedButton }
· constructor TRedSpeedButton.Create(AOwner: TComponent);
· begin
· inherited Create(AOwner);
· Font.Color := clRed;
· end;
· { TRedEdit }
· constructor TRedEdit.Create(AOwner: TComponent);
· { TRedLabel }
· constructor TRedLabel.Create(AOwner: TComponent);
· { the concrete factory }
· function TORedFactory.CreateSpeedButton(AOwner: TComponent): TSpeedButton;
· Result := TRedSpeedButton.Create(AOwner);
· function TORedFactory.CreateEdit(AOwner: TComponent): TEdit;
· Result := TRedEdit.Create(AOwner);
· function TORedFactory.CreateLabel(AOwner: TComponent): TLabel;
· Result := TRedLabel.Create(AOwner);
end.
运行的时候,我们的客户程序的实例由类的工厂具体类创建。并且客户程序不需知道使用工厂的具体子类。
正在组织
上一页 [1] [2]
Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved. 闵涛 E_mail:admin@mintao.net(欢迎提供学习资源)
鄂公网安备 42011102001154号
站长:MinTao ICP备案号:鄂ICP备11006601号-18