unit Supp;interfacetype
  TTime = class
    fDate : TDateTime;
    function GetText : string;
    constructor Create; overload;
    constructor Create(y, m, d : Integer); overload;  end;implementation
uses
SysUtils;function TTime.GetText : string;
begin
  GetText := DateToStr(fDate);
end;constructor TTime.Create;
begin
  fDate := Date;
end;constructor TTime.Create(y, m, d : Integer);
begin
  fDate := EncodeDate(y, m, d);
end;end.
unit Supp;interfacetype
  TTime = class
    fDate : TDateTime;
    function GetText : string;
    constructor Create(y, m, d : Integer); overload;  end;implementation
uses
SysUtils;function TTime.GetText : string;
begin
  GetText := DateToStr(fDate);
end;constructor TTime.Create(y, m, d : Integer);
begin
  fDate := EncodeDate(y, m, d);
end;end.以上两套代码如果没有 constructor Create; overload; 它们的分别和效果在哪里??
为什么一定要放     constructor Create; overload;??

解决方案 »

  1.   

    看看Delphi的基础知识
    1. 多态
    2. 构造器
      

  2.   

    楼主去看《DELPHI面向对象编程》这本书吧,你提到过的这么多个问题里面都有详细解说过。
      

  3.   

    多態與構造器(建議看《DELPHI面向对象编程》這本書...
      

  4.   

    楼主 跟楼上一样  好好从头学习一下吧 这个是基础的函数构造
    是不是也在学习vcl开发啊  还是搞本基础的书看看
      

  5.   

    同一个类中,有重名函数“Create”,所以用 overload 提示编译器,这个函数重复。
      

  6.   

    谢谢大家的建议。。
    本人就是看书看不明白 >.<;;
    而在这里希望有个详细解析。。((这不是借口。))
      

  7.   

    请改一改和建议,我的功课和能力测试。。http://topic.csdn.net/u/20100823/10/e500dad0-3992-4fb9-b54e-fcdc081d39f7.html你的一按,我的万分感激啊。。谢谢。。