Let's say I have a class declared as follows

type A =  class(TObject)
 X: TStringList
 constructor Create; override;
 destructor Destroy; override;
end;

constructor A.Create;
begin
       inherited Create;
      X:=TStringList.Create;
end;

destructor A.Destroy;
begin
        X.Free;
        inherited Destroy;
end;

Now I know that the default constructor for TObject will not allocate space
to X so it seems logical to override the default constructor with my own,
and call the inherited constructor within that. Ditto the destructor to
deallocate X.

Except that the keyword override next to my declared constructor and
destructor causes an error message about overriding a static method. So I
leave out the override keyword and it compiles.

But what is the difference?

============================================
Patrick Dunford, Christchurch, NZ
http://patrick.dunford.com/

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to