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

📄 testgenerics.out

📁 格式化源码的最新板
💻 OUT
字号:
unit TestGenerics;


{ AFS November 2007 

  This code compiles, but is not semantically meaningfull.
  It is test cases for the code-formating utility

  Test new generics syntax - code from TridenT
}


interface

uses
  SysUtils;

type
  TGenericType<AnyType> = class
    FData: AnyType;
    function GetData: AnyType;
    procedure SetData(Value: AnyType);
    property Data: AnyType Read GetData Write SetData;
  end;

implementation

function TGenericType<AnyType>.GetData: AnyType;
begin
  Result := FData;
end;

procedure TGenericType<AnyType>.SetData(Value: AnyType);
begin
  FData := Value;
end;

type
  TGenericTypeInt = TGenericType<integer>;

var
  I: TGenericTypeInt;

initialization
  try
    with TGenericType<integer>.Create do
      Data := 100;

    I      := TGenericTypeInt.Create;
    I.Data := 100;
    WriteLn(I.Data);

    ReadLn;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

⌨️ 快捷键说明

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