Ryan Joseph
2018-12-04 02:36:14 UTC
Some questions about old-style objects.
1) How can you check if self is assigned? self refers to the struct itself but if the object was allocated on the stack then how do we know self is a pointer or not?
procedure TMyObject.Free;
begin
if self <> nil then
dispose(self,Destroy);
end;
2) Is there any TObject support in objects? I know there is a VMT table for objects but I’m not sure if it’s structure is public in the RTL.
class function TMyObject.ClassName:string;
begin
result := PVmt(self)^.vClassName^;
end;
3) why are operator overloads not supported in objects? Is there a technical reason for that?
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailma
1) How can you check if self is assigned? self refers to the struct itself but if the object was allocated on the stack then how do we know self is a pointer or not?
procedure TMyObject.Free;
begin
if self <> nil then
dispose(self,Destroy);
end;
2) Is there any TObject support in objects? I know there is a VMT table for objects but I’m not sure if it’s structure is public in the RTL.
class function TMyObject.ClassName:string;
begin
result := PVmt(self)^.vClassName^;
end;
3) why are operator overloads not supported in objects? Is there a technical reason for that?
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailma