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

delphi virtual dynamic

dynamic¾ÍÊÇËüÊǶ¯Ì¬·½·¨£¬Ã»Óо²Ì¬µØÖ·£¬ËùÒÔËÙ¶ÈÂýÒ»µã
virtualÊÇÐé·½·¨£¬Èç¹ûÔÚ»ùÀàÖв»ÉùÃ÷³ÉÐé·½·¨µÄ»°£¬¼Ì³Ðºó£¬¸Ã·½·¨»áÌáʾһ¾¯¸æÐÅÏ¢£¬°Ñ»ùÀàÖз½·¨ÆÁ±ÎµôÁË
---------------------------------------------------------------
¶¯Ì¬£¨Dynamic£©ºÍÐéÄ⣨Virtual£©ºó¶¼¿ÉÒÔʹÓÃOverride¹Ø¼ü×ÖÔÚÅÉÉúÀàÖжԶÔÓ¦·½·¨½øÐи²¸Ç´Ó¶øʵÏÖ¶à̬......
ÐéÄâ·½·¨ºÍ¶¯Ì¬·½·¨ÔÚÓïÒåÉÏ¿ÉÒÔ˵Êǵȼ۵ģ¬ËûÃÇΨһµÄÇø±ðÔÚÓÚ¶Ô·½·¨µ÷ÓòßÂÔµÄÄÚ²¿ÊµÏÖÉÏ£ºÐéÄâ·½·¨´ÓËÙ¶È×îÓÅ»¯µÄ½Ç¶ÈʵÏÖ´úÂëÓÅ»¯£¬¶ø¶¯Ì¬·½·¨ÔòÊÇ´Ó¿Õ¼ä×îÓŵĽǶÈʵÏÖ´úÂëÓÅ»¯......
±»¸²¸ÇµÄ¶¯Ì¬·½·¨ÔÚÅÉÉúÀàµÄVMTÖв»ÔÙ³öÏÖ........ËùÒÔ½ÚÊ¡¿Õ¼ä........µ«²éѯËÙ¶ÈÂý
±»¸²¸ÇµÄÐéÄâ·½·¨ÔÚÅÂÉúÀàµÄVMTÖÐÔٴγöÏÖ........ËùÒÔ²éѯËٶȿì......µ«ÀË·Ñ¿Õ¼ä
---------------------------------------------------------------
ÐéÄâ·½·¨ºÍ¶¯Ì¬·½·¨
 
Ҫʹһ¸ö·½·¨³ÉΪÐéÄâµÄ»ò¶¯Ì¬µÄ£¬ÐèÒªÔÚÆäÉùÃ÷ÖаüÀ¨Ö¸Ê¾×Övirtual»òdynamic¡£ÐéÄâ·½·¨ºÍ¶¯Ì¬·½·¨²»Í¬ÓÚ¾²Ì¬·½·¨£¬ËüÃÇ¿ÉÒÔÔÚÆäºóÒáÀàÖб»¸²¸Ç£¨overridden£©¡£µ±Ò»¸ö¸²¸Ç·½·¨±»µ÷ÓÃʱ£¬·½·¨µ÷ÓÃÖÐʹÓõÄÀà»ò¶ÔÏóµÄʵ¼Ê£¨ÔËÐÐʱ£©ÀàÐ;ö¶¨ÁËÄÄÒ»¸öʵÏÖÊÇÓÐЧµÄ£¬¶ø·Ç±äÁ¿ÉùÃ÷µÄÀàÐ;ö¶¨¡£
Òª¸²¸ÇÒ»¸ö·½·¨£¬ÐèÒªÔÚÔÙÉùÃ÷ÖÐʹÓÃָʾ×Öoverride¡£Ò»¸öoverrideÉùÃ÷±ØÐèÓëÆä×æÏÈÉùÃ÷ÔÚ²ÎÊý˳ÐòºÍÀàÐÍÒÔ¼°½á¹û£¨Èç¹ûÓУ©µÈ¸÷·½ÃæÆ¥Åä¡£
ÏÂÃæµÄÀý×ÓÖУ¬TFigureÖÐÉùÃ÷µÄDraw·½·¨ÔÚÁ½¸öºóÒáÀàÖж¼±»¸²¸Ç¡£
type
  TFigure = class
    procedure Draw; virtual;
  end;
  TRectangle = class(TFigure)
    procedure Draw; override;
  end;
  TEllipse = class(TFigure)
    procedure Draw; override;
  end;
¶ÔÓÚÉÏÃæ¸ø³öµÄÉùÃ÷£¬ÏÂÃæµÄ´úÂë¾ÙÀý˵Ã÷ÁËÔÚÔËÐÐʱͨ¹ýÒ»¸ö±äÁ¿µ÷ÓÃÐéÄâ·½·¨Ê±£¬ÆäÀàÐͱ仯µÄЧ¹û¡£
var
  Figure: TFigure;
begin
  Figure := TRectangle.Create;
  Figure.Draw;  //µ÷ÓõÄÊÇTRectangle.Draw
  Figure.Destroy;
  Figure := TEllipse.Create;
  Figure.Draw;  //µ÷ÓõÄÊÇTEllipse.Draw
  Figure.Destroy;
end;
Ö»ÓÐÐéÄâ·½·¨ºÍ¶¯Ì¬·½·¨¿ÉÒÔ±»¸²¸Ç¡£È»¶ø£¬ËùÓеķ½·¨¶¼¿ÉÒÔ±»ÖØÔØ£¨overloaded£©£¬¼ûÖØÔØ·½·¨¡£
ÐéÄâºÍ¶¯Ì


Ïà¹ØÎĵµ£º

Delphi×é¼þ¿ª·¢½Ì³ÌÖ¸ÄÏ£¨1£©×é¼þ¿ª·¢¸ÅÊö

ÔÚ¿ª½²Ö®Ç°£¬Ê×ÏÈ£¬ÎÒ¼ÙÉèÄãÁ˽âʲôÊÇÃæÏò¶ÔÏó£¬Ê²Ã´ÊÇÀà¡£Èç¹û²»Á˽âµÄ»°£¬½¨ÒéÏÈÈ¥Á˽âÒ»ÏÂÏà¹Ø֪ʶ£¡
  
ÔÚDelphiÖУ¬×é¼þ£¬ÎÒÃÇ¿ÉÒÔ½«ËüÀí½âΪһ¸ö¸öµÄ·â×°ºÃÁ˵ŦÄܶÔÏó¿â£¬Ê¹ÓÃÕâ¸ö¿â£¬¾ÍÖ»Óüòµ¥µÄ¼¸¾ä´úÂ룬ÉõÖÁ½ö½ö¼òµ¥µÄÉèÖü¸¸öÊôÐÔ¾ÍÄÜʵÏÖijЩ
¹¦ÄÜ£¬ÎÒÃÇ¿ÉÒÔ½«×é¼þÏëÏó³ÉÈÕ³£Éú»îÖÐʹÓõÄijЩ ......

Delphi ×é¼þ¿ª·¢½Ì³ÌÖ¸ÄÏ£¨3£©×é¼þ×¢²á

ÔÚÉÏһƪÖУ¬ÎÒÃǼòµ¥µÄʵÏÖÁËÒ»¸ö¶ÔDelphi×ÔÉíµÄTEdit±à¼­¿ò¿Ø¼þµÄÒ»¸öÀ©³ä£¡µ«ÊÇÎÒÃDz¢²»ÄÜÏñDelphi×Ô¼ºµÄTEditÒ»Ñù£¬Äܹ»
ÔÚÉè¼Æ״̬ϽøÐÐÉè¼Æ£¬¶øÊǷǵÃÒª×Ô¼ºÊÖ¶¯´´½¨¿Ø¼þ£¬È»ºó²ÅÄÜʹÓá£Õâ¸öËäȻ˵ҲÊÇ×é¼þ£¬µ«ÊÇȴʧȥÁË×é¼þµÄ¿ÉÉè¼ÆµÄ·½±ãÐÔ£¬½ö½ö¿É×÷Ϊһ¸öÀà¿âÀ´Ê¹Óá£
ÏÖÔÚÎÒ¾ÍÀ´½éÉÜһϣ¬ÈçºÎÈÃÕâ¸ö×é¼þ×¢ ......

delphiʵÏÖ×Ö·û´®ÖÐÊý×ÖµÄÅжϼ°ÏàÓ¦Êý×ÖÀÛ¼Ó

×î½üÃæÊÔÁËÒ»¼ÒÆóÒµ,ÏÂÃæÓÐÒ»µÀ´ÓÀ´Ã»ÓÐÏë¹ýµÄÎÊÌâ,µ±Ê±ÓÐ˼·,²»¹ýд²»³öÀ´.»ØÀ´ºó,µ÷ÊÔÁËÒ»ÏÂ,·¢ÏÖ»¹ÊÇÓÐÄѶȵÄ,дÉÏÀ´¿´´ó¼ÒÊÇ·ñ»¹ÓиüÓÅ»¯µÄд·¨,»¶Ó­ÌÖÂÛ:
ÏÂÃæʵÏÖ½«×Ö·û´®"10ad200d3" ÖеÄÊý×ֺϼÆ,10+200+3=213
var s1:string;
var i:integer;
var n1:integer;
var tem1: string;
var tem2:integer;
  ......

DelphiʼþµÄ¹ã²¥


    Ã÷Ìì¾ÍÊÇÎåÒ»½ÚÁË£¬ÐÁ¿àÁ˺ü¸¸öÔ£¬½è´Ë»ú»áÓ¦¸Ã¾¡Çé·ÅËÉÒ»·¬¡£¿ÉÊÇÏëµ½BlogºÃ¾ÃûÓÐдÎÄÕ£¬ËƺõȱЩʲôËƵġ£Õ⼸¸öÔÂÀ´ÔÚÏîÄ¿ÖÐÓÖÔö³¤ÁËÐí¶à¾­Ñ飬ѧµ½Ðí¶àʵ¼ÊÓ¦ÓõÄ֪ʶ¡£²»Èç°ÑһЩ±È½ÏÓÐÓõļǼÏÂÀ´£¬¹©ÅóÓÑÃDzο¼¿ÉºÃ¡£
ÎÒÏëµ½DelphiµÄʼþ£¬ÄÇ¿ÉÕæÊǸö·½±ãµÄ¶«Î÷£¬³õѧÕßÔÚ´°ÌåÉÏÀ­¼¸¸ö¿ ......

Delphi±í´ïʽ

function ExpCalc(exp: string): string;
var
vScript: Variant;
begin
vScript := CreateOleObject('ScriptControl');
vScript.Language := 'VBScript';
Result := vScript.Eval(exp);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s:string;
begin
s:=ExpCalc('100 *4.17/0.5*(55. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ