TA = class strict private spv: Integer; protected pv: Integer; type //开始定义类中类 TIAproc = reference to procedure; TIA = class //类中类 strict private ispv: Integer; public class procedure ipA; virtual; end; procedure pB; type //又开始定义类中类了 TIB = class(TA.TIA) public class procedure ipA; override; end; public procedure pA; end; { TA.TIB } class procedure TA.TIB.ipA; begin inherited; showmessage('TA.TIB.ipA'); end; { TA.TIA } class procedure TA.TIA.ipA; begin showmessage('TA.TIA.ipA'); end; { TA } procedure TA.pA; begin end; procedure TA.pB; begin end;从上面,也可以看出class function是可以继承的,所以就算类函数,其实是有self参数。要想彻底和java的类函数一样,得给类函数加上static关键字。
Delphi7后有不少新语法,写语法blog有点土,直接看吧。
static 类方法是没有Self的概念的
回复删除