DelphiµÄ5ÖÖ·½·¨ÀàÐÍ
DelphiµÄ·½·¨ÀàÐÍÓУº
1.¾²Ì¬·½·¨ (Static) ĬÈÏÀàÐÍ£¬¿ÉÒÔÊ¡ÂԹؼü×Ö
2.ÐéÄâ·½·¨ (Virtual)
3.¶¯Ì¬·½·¨ (Dynamic)
4.ÏûÏ¢·½·¨ (Message)
5.³éÏó·¨·½ (Abstract)
=======================================================
1£©¾²Ì¬·½·¨[static]
¾²Ì¬·½·¨ÀàËÆÓÚͨ³£µÄ¹ý³ÌºÍº¯Êý£¬±àÒëÆ÷ÔÚ±àÒëʱ¾ÍÒÑÖ¸¶¨ÁËÊä³ö¸Ã·½·¨
µÄ¶ÔÏóʵÀý¡£¾²Ì¬·½·¨µÄÖ÷ÒªÓŵãÊǵ÷ÓÃËٶȿ졣
eg£º
type
TAnimal = class(TObject)
procedure Sound;
procedure Sleep;
... ...
end;
... ...
TDog = class(TAnimal)
procedure Sound;
function Sleep:Integer;
... ...
end;
¾²Ì¬·½·¨²»Äܱ»ÖØÔØ£¬ÉÏÀýÖУ¬ÅÉÉúÀàµÄ¾²Ì¬·½·¨Ö»ÊÇÌæ»»ÁË»ùÀàµÄ¾²Ì¬·½
·¨¡£¼´Ê¹Sleep·½·¨ÔÚTAnimalÖбíÏÖΪ¹ý³Ì¶øÔÚTDogÀàÖбíÏÖΪº¯Êý¡£
=======================================================
2£©ÐéÄâ·½·¨[virtual]
ÐéÄâ·½·¨±È¾²Ì¬·½·¨¸üÁé»î¡¢¸ü¸´ÔÓ¡£ÐéÄâ·½·¨µÄµØÖ·²»ÊÇÔÚ±àÒëʱȷ¶¨µÄ
£¬¶øÊÇÔÚ³ÌÐòÔËÐÐÆÚ¼ä¸ù¾Ýµ÷ÓÃÕâ¸öÐéÄâ·½·¨µÄ¶ÔÏóʵÀýÀ´È·¶¨µÄ£¬ÕâÖÖ·½
·¨ÓÖ³ÆΪÖͺóÁª±à¡£ÐéÄâ·½·¨ÔÚ¶ÔÏóÐéÄâ·½·¨±í£¨VMT£©ÖÐÕ¼ÓÐÒ»¸öË÷ÒýºÅ
eg:
type
TAnimal = class(TObject)
procedure Eat;
procedure Sound; virtual;
procedure Sleep; dynamic;
... ...
end;
TDog = class(TAnimal)
procedure Sound; override; //ÖØÔØ
function Sleep:Integer; override;
... ...
end;
Ö»ÓÐvirtualºÍdynamic¿ÉÒÔ±»override£¬static²»Äܱ»override(ÖØÔØ)¡£
=======================================================
3£©¶¯Ì¬·½·¨[dynamic]
±»ÉùÃ÷Ϊ¶¯Ì¬·½·¨µÄ·½·¨²»ÊÇ·ÅÔÚÀàµÄÐéÄâ·½·¨±íÖУ¬¶øÊÇÓɱàÒëÆ÷Ö¸¶¨Ò»
¸öË÷ÒýºÅ£¨Ò»°ã²
Ïà¹ØÎĵµ£º
µÚÒ»ÖÖ·½·¨£º
µÚÒ»²½£º ÐÞ¸ÄÊôÐÔ
1¡¢kind -> dtktime Ò²¿ÉÒÔÊÇdtkdate µ«ÊÇÔÚÓÃdtkdateµÄʱºòÐèÒª½«datemodeÊôÐÔÐ޸ijÉdmUpDown
2¡¢parseinput -> true
µÚ¶þ²½£ºÔÚonUserInputʼþÖÐдһ¾ä´úÂë
DateTimePicker1.DateTime:=DateAndTime;
×¢£ºÒÔÉÏ·½·¨ËäÈ»¿ÉÒԴﵽĿµÄ£¬µ ......
TMS Scripter£ºÖ§³ÖPascalºÍVBScriptÁ½ÖÖÓï·¨¡£ÓŵãÊÇÎĵµÆëÈ«¡¢Àý×ÓÆëÈ«£¬½Å±¾¿ÉÖ±½ÓÖ§³ÖDLL£¬¹Ù·½»¹ÌṩÁ˷ḻµÄIDE Debug¹¤¾ß¡¢µ¥Ôªµ¼³öº¯Êý¹¤¾ßµÈ£¬È±µãÊDZàÒëÔËÐнÏÂý¡£for ¿ÕÑ»·1000Íò´Î£¬ÐèÒª10ÃëÖÓÒÔÉÏ¡£TMS ScripterÊÇÉÌÒµ¹²ÏíÈí¼þ¡£
FastScript£ºÓùýFastReport±¨±íµÄÍ¬Ñ ......
dynamic¾ÍÊÇËüÊǶ¯Ì¬·½·¨£¬Ã»Óо²Ì¬µØÖ·£¬ËùÒÔËÙ¶ÈÂýÒ»µã
virtualÊÇÐé·½·¨£¬Èç¹ûÔÚ»ùÀàÖв»ÉùÃ÷³ÉÐé·½·¨µÄ»°£¬¼Ì³Ðºó£¬¸Ã·½·¨»áÌáʾһ¾¯¸æÐÅÏ¢£¬°Ñ»ùÀàÖз½·¨ÆÁ±ÎµôÁË
---------------------------------------------------------------
¶¯Ì¬£¨Dynamic£©ºÍÐéÄ⣨Virtual£©ºó¶¼¿ÉÒÔʹÓÃOverride¹Ø¼ü×ÖÔÚÅÉÉúÀàÖжԶÔÓ¦ ......
delphiµ÷ÓÃÑ¡ÔñĿ¼¶Ô»°¿ò
¾³£¼ûÍøÉÏÓÐÈËÎÊÑ¡ÔñĿ¼¶Ô»°¿òµÄ¿Ø¼þ£¬ÆäʵֻÓÃÒ»¸öº¯Êý¾Í¿ÉÒÔʵÏÖ¡£
×¢ÒâÒýÓÃ Filectrl µ¥Ôª
use Filectrl;
procedure TForm1.Button1Click(Sender: TObject);
var
Dir: String;
begin
SelectDirectory('Select a directory', '', Dir);
ShowMessage(Dir);
end; ......
ËäÊÇÔ´´£¬µ«ÊÇÊDzο¼¹ý±ðÈ˵Ä×÷Æ·£¬È»ºó×Ô¼ºÖØÐÂдµÄ£¬Ä¿µÄÊÇÒª¸ø³õѧÕßÒ»¸ö¸üÈÝÒ×Ã÷°×¡£
ÓÃDELPHI´´½¨DLLÎļþ£¬·â×°´°ÌåµÄʵÏÖ·½·¨ÊµÀý£º
¼´Ò»¸ö³ÌÐò²»ÔÙÊǵ¥Ò»µÄÒ»¸öEXEÎļþÁË£¬¶øÊÇÓÉÒ»¸öEXEÎļþ¼ÓN¸öDLLÎļþ×é³É£¬ÕâÑù×öµÄÔÒòÊÇ·½±ãÒÔºóµÄά»¤Óë¸üУ¬Ò²ÊÇ¿çƽ̨¿ª·¢µÄÖØÒªÒ»²½¡£
1£¬ ´ò¿ªDELPHI£¬Ð½¨Ò»¸öDl ......