现在的位置: 首页 > 综合 > 正文

面向过程的门面模式

2011年09月02日 ⁄ 综合 ⁄ 共 1923字 ⁄ 字号 评论关闭
{*******************************************************}
{                                                       }
{       业务逻辑一                                      }
{                                                       }
{       版权所有 (C) 2008 陈新光                        }
{                                                       }
{*******************************************************}

unit Hello1;

interface

uses
  Dialogs;

procedure SayHello;

implementation

procedure SayHello;
begin
  ShowMessage('hello one');
end;  

end.
{*******************************************************}
{                                                       }
{       业务逻辑二                                      }
{                                                       }
{       版权所有 (C) 2008 咏南工作室                    }
{                                                       }
{*******************************************************}

unit Hello2;

interface

uses
  Dialogs;

procedure SayHello2;

implementation

procedure SayHello2;
begin
  ShowMessage('hello two');
end;  

end.
{*******************************************************}
{                                                       }
{       接口                                            }
{                                                       }
{       版权所有 (C) 2008 咏南工作室                    }
{                                                       }
{*******************************************************}

unit InterFace1;

interface

uses
  Hello1,Hello2;

procedure Say1;
procedure Say2;

implementation

procedure Say1;
begin
  SayHello;
end;

procedure Say2;
begin
  SayHello2;
end;  

end.
{*******************************************************}
{                                                       }
{       主程序                                          }
{                                                       }
{       版权所有 (C) 2008 咏南工作室                    }
{                                                       }
{*******************************************************}

unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,StdCtrls,
  InterFace1;//接口

type
  TForm1 = class(TForm)
    btn1: TButton;
    btn2: TButton;
    procedure btn1Click(Sender: TObject);
    procedure btn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
begin
  Say1;
end;

procedure TForm1.btn2Click(Sender: TObject);
begin
  Say2;
end;

end.
 

【上篇】
【下篇】

抱歉!评论已关闭.