📄 testgenericconstructorstatic.out
字号:
program TestGenericConstructeurStatic;
{$APPTYPE CONSOLE}
{ AFS December 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
}
uses
SysUtils;
type
EContrainteArgumentException = class(ArgumentException);
MaClasse<T> = class
UnChamp: T;
S: string;
constructor Create;
class constructor CreateClass;
end;
constructor MaClasse<T>.Create;
begin
inherited;
S := 'Initialisation';
Writeln(#9 + #9 + #9 + 'Appel du constructeur d''instance', Self.ClassName, '.Create');
end;
class constructor MaClasse<T>.CreateClass;
var
UnEntier: integer;
VarGeneric: T;
begin
Writeln;
Writeln(#9 + #9 + 'Appel du constructeur de classe MaClasse.CreateClass<', Typeof(T), '>');
VarGeneric := default(T);
UnEntier := 10;
//Est-ce un type valeur et le param閠re de type est-il un integer ?
if (assigned(TObject(VarGeneric)) = True) and (TObject(UnEntier) is T) then
raise EContrainteArgumentException.Create(
'L''utilisation du type Integer n''est pas autoris
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -