Delphi Éè¼Æģʽ£º¡¶HeadFirstÉè¼Æģʽ¡·Delphi7´úÂë
1. ÃüÁîµÄ½ÓÊÜÕß
unit uReceiveObject;
interface
type
TLight = class(TObject)
public
procedure Open;
procedure Off;
end;
TGarageDoor = class(TObject)
public
procedure Up;
procedure Down;
procedure Stop;
procedure LightOn;
procedure LightOff;
end;
implementation
{ TLight }
procedure TLight.Off;
begin
Writeln('');
end;
procedure TLight.Open;
begin
Writeln('Light is On.');
end;
{ TGarageDoor }
procedure TGarageDoor.Down;
begin
Writeln('');
end;
procedure TGarageDoor.LightOff;
begin
Writeln('');
end;
procedure TGarageDoor.LightOn;
begin
Writeln('');
end;
procedure TGarageDoor.Stop;
begin
Writeln('');
end;
procedure TGarageDoor.Up;
begin
Writeln('GarageDoor is Open.');
end;
end.
2.ÃüÁî¶ÔÏó
unit uCommandObject;
interface
uses
uReceiveObject;
type
TCommand = class(TObject)
public
procedure Execute; virtual; abstract;
end;
TLightOnCommand = class(TCommand)
private
FLight: TLight;
public
constructor Create(aLight: TLight);
procedure Execute; override;
end;
TGarageDoorOpenCommand = class(Tcommand)
private
FGarageDoor: TGarageDoor;
public
constructor Create(aGarageDoor: TGarageDoor);
procedure Execute; override;
end;
implementation
{ TLightOnCommand }
constructor TLightOnCommand.Create(aLight: TLight);
begin
FLight := aLight;
end;
procedure TLightOnCommand.Execute;
begin
FLight.Open;
end;
{ TGarageDoorOpenCommand }
constructor TGarageDoorOpenCommand.Create(aGarageDoor: TGarageDoor);
begin
FGarageDoor := aGarageDoor;
end;
procedure TGarageDoorOpenCommand.Execute;
begin
FGarageDoor.Up;
end;
end.
3.ÃüÁîµÄÇëÇóÕß¼´·¢³öÕß
unit uSimpleRemoteControl;
interface
uses
uCommandObject;
type
TSimpleRemoteControl = class(TObject)
private
FSlot: TCommand;
public
procedure SetCommand(aCommand: TCommand);
procedure ButtonWasPressed;
end;
implementation
Ïà¹ØÎĵµ£º
Delphi2010¼¯³ÉÁËfastMM£¬Õâ»Ø´ó¼Òµ÷ÊÔ³ÌÐòÊǵÄʱºò¿ÉÒÔ·½±ãµØ¼ì²éÄÚ´æй¶ÁË¡£
ʹÓ÷½·¨ÈçÏ£º
ÔÚprojectÖУ¬Ìí¼ÓÒ»ÐÐ ReportMemoryLeaksOnShutdown := DebugHook<>0;
DebugHook<>0 Ä¿µÄÊDZ£Ö¤µ¥¶ÀÔËÐÐexeÎļþ²»»áµ¯³öÄÚ´æй¶¿ò£¬Ô´Âë¿ÉÒÔ²»ÓÃ×¢Ê͵ô´ËÐÐ
program Project1;
uses
Forms,
......
±¾ÎĵÄÏßÐÔÁÁ¶È/¶Ô±È¶Èµ÷Õû·½·¨ÊÇÔÚ¡¶¸Ä½øµÄͼÏñÏßÐÔÁÁ¶Èµ÷Õû·½·¨¡·Ò»ÎÄÖÐÏßÐÔÁÁ¶Èµ÷Õû·½·¨Ó롶DelphiͼÏñ´¦Àí -- PhotoshopͼÏñÁÁ¶È/¶Ô±È¶Èµ÷Õû¡·ÖеĶԱȶȵ÷Õû·½·¨»ù´¡ÉÏÐγɵģ¬ÆäÔÀíºÍÌصã¿É²Î¼ûÕâ2ƪÎÄÕ£º
¹ý³Ì¶¨Ò壺
// ÏßÐÔµ÷ÕûÁÁ¶È£¬ValueÁÁ¶ÈÖµ
procedure ImageL ......
Python , Delphi , Loki Èý¸öµ¥´ÊÓÐȤµÄÀ´Ô´
Ðí¶à³ÌÐòÉè¼ÆÓïÑԺͿª·¢¹¤¾ßÒÔ¼°¿âµÄÃû×Ö¶¼À´Ô´ÓëÉñ»°£¬ÆÄÓÐÒâ˼£º
°¢²¨ÂÞÊÇͬʱ³öÏÖÔÚÏ£À°ºÍÂÞÂíÉñ»°ÖеİÂÁÖÅÁ˹ʮ¶þ´óÉñÖ®Ò»¡£Ëû³ýÁËÓµÓÐÌ«ÑôÉñµÄÉí·Ö£¬Í¬Ê±»¹ÓÐÔ¤ÑÔ¡¢ÒÕÊõ¡¢Ò½ÊõÖ®ÉñµÄ³ÆºÅ¡£°¢²¨ÂÞÊÇÖæ˹ºÍÀÖ¶äµÄ¶ù×Ó£¬ºÍ°¢µÙÃÛ˹ÊÇË ......
Ò»¡¢Ò»¸ö½ÐÉù½Ó¿ÚºÍ¼¸Ö»Ñ¼×Ó
1¡¢´ÓÒ»¸ö½ÐÉù½Ó¿Ú¿ªÊ¼
{¡¶HeadFirstÉè¼Æģʽ¡·Delphi´úÂë֮ģʽС½á }
{ Ò»¸ö½ÐÉù½Ó¿Ú }
{ ±àÒ빤¾ß£ºDelphi2010 for win32 }
{ E-Mail £ºxshlife@163.com }
unit uQuackable;
interface
type
IQuackable = in ......
ʲôÊǶà̬£¬×ÖÃæÒâ˼¾ÍÊÇ“¶àÖÖÐÎ̬”£¬ÓöÔÏóÀ´½²¾ÍÊÇ×ÓÀà¼Ì³Ð»ùÀ࣬¶ø²»Í¬µÄ×ÓÀàÓÖ·Ö±ð¶Ô»ùÀà½øÐй¦ÄܵÄÀ©Õ¹¡£
¶à̬ÔÚObject PascalÖÐÊÇͨ¹ýÐé·½·¨ÊµÏֵģ¨Virtual Method£©,ÔÚObject PascalÖлùÀàµÄÐé·½·¨ÊÇ¿ÉÒÔ±»ÅÉÉúÀา¸Ç£¨Override£©µÄ ......