I created a class in delphi. It looks like this
TGoJsNode = class(TPersistent)
private
_id: Integer;
Key: Integer;
Text: String;
constructor Create;
end;
I need to check when this class have been effectively created (Used the constructor). Example, when I do this:
var
x: TGoJsNode;
begin
if Assigned(x) then
// Will return True
showmessage('created');
if x = nil then
// Will also return True
showmessage('created');
end;
Both of these tests will result in true, when in fact i did not created x. In my opinion x should only result true in the assigned test when i create it, like so:
procedure TForm1.Button18Click(Sender: TObject);
var
x: TGoJsNode;
begin
x := TGoJsNode.Create;
end;
Another weird thing I observed is that the private numeric variables have random values and the string one is empty. All the classes are in the same Unit file. Any Ideas?