⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testderef.out

📁 格式化源码的最新板
💻 OUT
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -