zoukankan      html  css  js  c++  java
  • 深入类中的方法[3] - 方法在实现时的参数省略

    
    
    unit Unit1;
    
    
    interface

    uses   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,   Dialogs, StdCtrls;
    type  
    TForm1 = class(TForm)  
    end
    ;
    TBass = class
      function Fun1(x,y: Integer): Integer; virtual; {Fun1 有 virtual 指示字}
       function Fun2(x,y,z: Integer): Integer;        {Fun2 有三个参数、一个返回值}
     end;
     var   Form1: TForm1;
    implementation
    {$R *.dfm}
    { TBass }
     function TBass.Fun1(x, y: Integer): Integer; {方法实现时, 不能带 virtual 等指示字}
     begin 
     Result := x + y;
     end;
    function
    TBass.Fun2(x,y,z: Integer): Integer; {方法实现时可以只有函数名; 如果带参数和返回值, 必须和定义时一样} begin   Result := x + y + z;
     end;
     end.
  • 相关阅读:
    03-字典
    02-列表
    01-字符串操作
    Django中的跨域问题
    Codeforces Round #617 (Div. 3) A
    Codeforces Round #717 (Div. 2) A
    如何在Vuespa中使用less
    excle导出
    ajaxFileUpload上传文件
    图片插入word
  • 原文地址:https://www.cnblogs.com/luckForever/p/7255037.html
Copyright © 2011-2022 走看看