Smart pascal source code
type
TMyObj = class
Field : Integer;
procedure Proc;
procedure ProcVirtual; virtual;
end;
procedure TMyObj.Proc;
begin
WriteLn('Proc');
WriteLn(Field);
end;
procedure TMyObj.ProcVirtual;
begin
WriteLn('ProcVirtual');
WriteLn(Field);
end;
var o : TMyObj;
Begin
if Assigned(o) then
WriteLn('bug');
o := TMyObj.Create;
if Assigned(o) then
WriteLn('Assigned');
o.Field:=1234;
o.Proc;
o.ProcVirtual;
o:=nil;
if not Assigned(o) then
WriteLn('not Assigned');
try
o.Field:=456;
except
on E : Exception do
WriteLn(E.Message);
end;
try
o.Proc;
except
on E : Exception do WriteLn(E.Message);
end;
try
o.ProcVirtual;
except
on E : Exception do
WriteLn(E.Message);
end;