Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Delphi Éè¼Æģʽ£º¡¶HeadFirstÉè¼Æģʽ¡·Delphi7´úÂë

Ä£°å·½·¨Ä£Ê½¶¨ÒåÁËÒ»¸öËã·¨¹Ç¼Ü£¬ÔÊÐí×ÓÀà¶ÔËã·¨µÄij¸ö»òijЩ²½Öè½øÐÐÖØд£¨override)¡£
1.CoffeineBeverageWithHook
{¡¶HeadFirstÉè¼Æģʽ¡·Ö®Ä£°å·½·¨Ä£Ê½ }
{ ±àÒ빤¾ß: Delphi7.0 }
{ E-Mail : xshlife@163.com }

unit uCoffeineBeverageWithHook;

interface

uses
SysUtils;

type
TCoffeineBeverageWithHook = class(TObject)
protected
procedure BoilWater;
procedure Brew; virtual; abstract;
procedure PourInCup;
procedure AddCondiments; virtual; abstract;
function CustomerWantsCondiments: Boolean; virtual; { ¹³×Ó }
public
procedure PrepareRecipe; { Ä£°å·½·¨ }
end;

TCoffeeWithHook = class(TCoffeineBeverageWithHook)
private
function GetUserInput: string;
public
procedure Brew; override;
procedure AddCondiments; override;
function CustomerWantsCondiments: Boolean; override;
end;

TTeaWithHook = class(TCoffeineBeverageWithHook)
private
function GetUserInput: string;
public
procedure Brew; override;
procedure AddCondiments; override;
function CustomerWantsCondiments: Boolean; override;
end;

implementation

{ TCoffeineBeverageWithHook }

procedure TCoffeineBeverageWithHook.BoilWater;
begin
Writeln('Boiling Water');
end;

function TCoffeineBeverageWithHook.CustomerWantsCondiments: Boolean;
begin
Result := True;
end;

procedure TCoffeineBeverageWithHook.PourInCup;
begin
Writeln('Poiling into cup');
end;

procedure TCoffeineBeverageWithHook.PrepareRecipe;
begin
BoilWater;
Brew;
PourInCup;
if CustomerWantsCondiments then
AddCondiments;
end;

{ TCoffeeWithHook }

procedure TCoffeeWithHook.AddCondiments;
begin
Writeln('Add Sugar and Milk');
end;

procedure TCoffeeWithHook.Brew;
begin
Writeln('Drip Coffee Through Filter');
end;

function TCoffeeWithHook.CustomerWantsCondiments: Boolean;
var
Answer: string;


Ïà¹ØÎĵµ£º

Îò͸delphi µÚ¶þÕ DELPHIÓëWIN32ʱ¿Õ

µÚÒ»Õ  DELPHIµÄÔ­×ÓÊÀ½ç
µÚ¶þÕ  DELPHIÓëWIN32ʱ¿Õ
µÚÈýÕ  ¶àÏß³Ì
µÚËÄÕ  ½Ó¿Ú
µÚÎåÕ  °ü
µÚÁùÕ  ʼþÓëÏûÏ¢
µÚÆßÕ  ×éÖ¯ÄãµÄÄ£¿é
µÚ°ËÕ  ̽Ë÷Êý¾Ý¿â
µÚ¾ÅÕ  ¶à²ãÌåϵ½á¹¹
µÚʮՠ ²Ù×÷½çÃæÓë²Ù×÷Âß¼­
µÚʮһÕ  ÃæÏò¶ÔÏóÊý¾Ý¿â»ù´¡
µÚ¶þÕÂ&n ......

Îò͸delphi µÚÈýÕ ¶àÏß³Ì

µÚÒ»Õ  DELPHIµÄÔ­×ÓÊÀ½ç
µÚ¶þÕ  DELPHIÓëWIN32ʱ¿Õ
µÚÈýÕ  ¶àÏß³Ì
µÚËÄÕ  ½Ó¿Ú
µÚÎåÕ  °ü
µÚÁùÕ  ʼþÓëÏûÏ¢
µÚÆßÕ  ×éÖ¯ÄãµÄÄ£¿é
µÚ°ËÕ  ̽Ë÷Êý¾Ý¿â
µÚ¾ÅÕ  ¶à²ãÌåϵ½á¹¹
µÚʮՠ ²Ù×÷½çÃæÓë²Ù×÷Âß¼­
µÚʮһÕ  ÃæÏò¶ÔÏóÊý¾Ý¿â»ù´¡
µÚÈýÕÂ&n ......

Îò͸delphi µÚÆßÕ ×éÖ¯ÄãµÄÄ£¿é

µÚÒ»Õ  DELPHIµÄÔ­×ÓÊÀ½ç
µÚ¶þÕ  DELPHIÓëWIN32ʱ¿Õ
µÚÈýÕ  ¶àÏß³Ì
µÚËÄÕ  ½Ó¿Ú
µÚÎåÕ  °ü
µÚÁùÕ  ʼþÓëÏûÏ¢
µÚÆßÕ  ×éÖ¯ÄãµÄÄ£¿é
µÚ°ËÕ  ̽Ë÷Êý¾Ý¿â
µÚ¾ÅÕ  ¶à²ãÌåϵ½á¹¹
µÚʮՠ ²Ù×÷½çÃæÓë²Ù×÷Âß¼­
µÚʮһÕ  ÃæÏò¶ÔÏóÊý¾Ý¿â»ù´¡
 ¿Õ ......

DelphiͼÏñ´¦Àí

    ͼÏñµÄÖÐÖµÂ˲¨£¬¾ÍÊÇÔÚÒÔijһÏñËØΪÖÐÐĵÄn½×ÏñËؾØÕóÖУ¬ÕÒ³öR¡¢G¡¢B¸÷·ÖÁ¿µÄÖмäÖµÀ´·Ö±ðÌæ´ú¸ÃÏñËصÄRGBÖµ£¬´Ó¶ø´ïµ½¶ÔͼÏñÔëÉùÂ˲¨µÄÄ¿µÄ¡£ÕâÀïµÄÖмäÖµ²¢·ÇÏñËؾØÕóR¡¢G¡¢B¸÷·ÖÁ¿µÄµÄËãÊõƽ¾ùÖµ£¬¶øÊÇÏñËؾØÕóR¡¢G¡¢B¸÷·ÖÁ¿ÅÅÐòºóµÄÖÐλÊýÖµ¡£
    ÏÂÃæÊÇDelphiͼÏñÖÐÖµÂ˲¨µÄÊµÏ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ