Hello,
I am not quite clear about calling the constructor of the based
class from the constructor of the derived class.
For example, I should do something like this:
type
TBaseClass = class(TObject)
public
color: TColor;
end;
TDerivedClass = class(TBaseClass)
constructor Create;
destructor Destroy;
end;
constructor TDerivedClass.Create;
begin
// is color variable available here?
inherited;
// other initialization steps
end;
destructor TDerivedClass.Destroy;
begin
// other clean up steps
inherited;
end;
However, sometimes I find that not calling inherited constructor
still works fine. Will this cause any trouble? Similarly, will not calling
the inherited destructor cause any memory leaks?
Also, before the inherited constructor is called, will the memebers
of the base class be accessible, e.g. the color variable in the above
code?
--
Best regards,
Jack
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi