[Delphi]笔记

自定义类

type
  TmyClass =Class
  public
  procedure myClassPro(str:string);
  function myClassFun(str:string):boolean;   //对象的方法 需要声明类才能调用
  Class procedure myClassCPro(str:string);
  Class function myClassCFun(str:string):string;   //类型的方法 可以直接调用,不用声明类
end;

function TmyClass.myClassFun(str:string):boolean;
Class function TmyClass.myClassCFun(str:string):string;

自定义数据类型也类似

type
  Date = record
    Year: Integer;
    Month: Byte;
    Day: Byte;
  end;

var
  BirthDay: Date;

begin
  BirthDay.Year := 1997;
  BirthDay.Month := 2;
  BirthDay.Day := 14;

不确定参数个数

procedure proc1(aa: array of TControl); //不指定类型控件
procedure proc2(bb: array of Variant); //不指定类型变量
procedure proc3(cc: array of string); //指定类型变量string

函数传参数
http://www.enet.com.cn/article/2009/1027/A20091027560392.shtml


http://www.pcbookcn.com/article/1566.htm

发表回复

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据