面向過程的門面模式

2021-04-15 18:20:46 字數 1348 閱讀 8678

unit hello1;

inte***ce

uses

dialogs;

procedure sayhello;

implementation

procedure sayhello;

begin

showmessage('hello one');

end;  

end.

unit hello2;

inte***ce

uses

dialogs;

procedure sayhello2;

implementation

procedure sayhello2;

begin

showmessage('hello two');

end;  

end.

unit inte***ce1;

inte***ce

uses

hello1,hello2;

procedure say1;

procedure say2;

implementation

procedure say1;

begin

sayhello;

end;

procedure say2;

begin

sayhello2;

end;  

end.

unit main;

inte***ce

uses

windows, messages, sysutils, variants, classes, graphics, controls, forms,

dialogs,stdctrls,

inte***ce1;//介面

type

tform1 = class(tform)

btn1: tbutton;

btn2: tbutton;

procedure btn1click(sender: tobject);

procedure btn2click(sender: tobject);

private

public

end;

varform1: tform1;

implementation

procedure tform1.btn1click(sender: tobject);

begin

say1;

end;

procedure tform1.btn2click(sender: tobject);

begin

say2;

end;

end.

面向過程的命令模式

type tformhycx class tformmdi private procedure menuitemclick sender tobject end procedure tformhycx.formcreate sender tobject vari integer begin inhe...

設計模式 門面模式

一 門面模式概述 門面模式是物件的結構模式,外部與乙個子系統的通訊必須通過乙個統一的門面物件進行。門面模式提供乙個高層次的介面,使得子系統更易於使用。1 門面角色 facade 這是門面模式的核心。它被客戶角色呼叫,因此它熟悉子系統的功能。它內部根據客戶角色已有的需求預定了幾種功能組合。2 子系統角...

設計模式 門面模式

門面模式 外觀模式 將子系統中的一組介面提供乙個一致的介面,外觀模式定義了乙個高層介面,這個介面使得這一子系統更加容易使用。1 它對客戶遮蔽子系統元件,因而減少了客戶處理的物件的數目並使得子系統使用起來更加方便。2 它實現了子系統與客戶之間的松耦合關係,而子系統內部的功能元件往往是緊耦合的。3 如果...