Code: Alles auswählen
program Project1;
uses Classes;
type
{$interfaces CORBA}
ITest=interface
function GetText: string;
property Text:string read GetText;
procedure Free;
end;
TATest=class(TComponent,ITest)
function GetText: string;
end;
TBTest=class(TComponent,ITest)
function GetText: string;
end;
function TATest.GetText: string;
begin
Result:='TATest.Test';
end;
function TBTest.GetText: string;
begin
Result:='TBTest.Test';
end;
var
MyTest:iTest;
begin
MyTest:=TATest.Create(nil);
writeln(MyTest.Text);
MyTest.Free; //ohne meldet heaptrc fehler
// if (MyTest is TATest) then; //geht nicht mit CORBA
if TATest(MyTest).Tag=1 then;
MyTest:=TBTest.Create(nil);
writeln(MyTest.Text);
MyTest.Free; //ohne meldet heaptrc fehler
end.