testderef.obs

来自「格式化源码的最新板」· OBS 代码 · 共 17 行

OBS
17
字号
unit testderef;interface implementation uses classes;type tamoeba=class;ptamoeba
=^tamoeba;tamoeba=class(TObject)private fsname:string;function getname:string;procedure
setname(const value:string);function getstuff(const psindex:string):tamoeba;procedure
getvaluelist(list:tstrings);public function getbar(const piindex:integer):tamoeba
;function myfudgefactor:tamoeba;function pointer:ptamoeba;function myindex:integer
;property name:string read getname write setname;property stuff[const psindex:string
]:tamoeba read getstuff;end;procedure testhatexpr(var foo:tamoeba);begin if((foo.
stuff['x'].pointer)^.myindex=0)then foo:=nil;end;procedure dotestderef(var foo:tamoeba
);var ls:string;begin foo.getbar(1).stuff['fish'].myfudgefactor.getbar(2).name:='Jiim'
;ls:=foo.stuff['fish'].getbar(1).myfudgefactor.getbar(2).name;end;function tamoeba
.getbar(const piindex:integer):tamoeba;begin result:=self;end;function tamoeba.getname
:string;begin result:=fsname;end;function tamoeba.getstuff(const psindex:string):
tamoeba;begin result:=self;end;function tamoeba.myfudgefactor:tamoeba;begin result
:=self;end;procedure tamoeba.setname(const value:string);begin fsname:=value;end;
procedure tamoeba.getvaluelist(list:tstrings);begin (getstuff('0')as tamoeba).myfudgefactor
.getvaluelist(list);end;function tamoeba.pointer:ptamoeba;begin result:=@self;end
;function tamoeba.myindex:integer;begin result:=1;end;end. 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?