我正在使用Delphi 2010并且有一个问题是重新释放对象.
假设我有如下代码,如果发生异常,我想清除TProduct和TPart.
如何释放正确包含的对象TPart?
//Clases are defined like this
TProduct = class(TRemotable)
private
FName: String;
FAge: Integer;
FColor: String;
FPart: TPart;
published
property Name: String read FName write FName;
property Age: Integer read FAge write FAge;
property Color: String read FString write FString;
property Part: TPart read FPart write FPart;
end;
TPart = class(TRemotable)
private
FName: String;
FColor: String;
published
property Name: String read FName write FName;
property Color: String read FString write FString;
end;
//Then in a method, code …Run Code Online (Sandbox Code Playgroud)