我在unit1中定义了一个涵数funciton xxx(cc):double,我想在unti5中重载,请问在unit5中该怎样用呢?还有就是在unit1中是否需在涵数funciton xxx(cc):double后加上overload?请大家多多帮忙,谢谢?

解决方案 »

  1.   

    同一个单元才用overload,多个单元互不相关
      

  2.   

    那么在同一个单元中又该怎样用呢?
    是不是:funciton xxx(cc:integer):double;overload;//已经声名过的.
    funciton xxx(cc:double):double;overload;//需要重载的.
      

  3.   

    只有一个 不用写overload就可以了
      

  4.   

    FUNCTION micUn_GetChecksum(CONST c_src: AnsiString;CONST c_bits: Byte = 32): LongWord;overload;
    FUNCTION micUn_GetChecksum(CONST c_src: WideString;CONST c_bits: Byte = 32): LongWord;overload;
      

  5.   

    摘录DELPHI HELP 解释得很清楚了You can declare more than one routine in the same scope with the same name. This is called overloading. Overloaded routines must be declared with the overload directive and must have distinguishing parameter lists. For example, consider the declarationsfunction Divide(X, Y: Real): Real; overload;
    begin
      Result := X/Y;
    end;
    function Divide(X, Y: Integer): Integer; overload;
    begin
      Result := X div Y;
    end;
      

  6.   

    overload的用法已经有人解释的很清楚了
    如果在同一个类中,有两个函数或过程,他们的功能很相似,但是需要传入的参数值不同,可以考虑用overload实现,这样在调用的时候,系统会根据传入的参数表自动判断需要调用的是哪个函数。