I'm trying to create a child class of TForm with
- a special constructor for certain cases, and
- a default constructor that will maintain compatibility with current code.
This is the code I have now:
interface
TfrmEndoscopistSearch = class(TForm)
public
/// original constructor kept for compatibility
constructor Create(AOwner : TComponent); overload; override;
/// additional constructor allows for a caller-defined base data set
constructor Create(AOwner : TComponent; ADataSet : TDataSet; ACaption : string = ''); overload;
end;
It seems to work, but I always get the compiler warning:
[Warning] test.pas(44): Method 'Create' hides virtual method of base type 'TCustomForm'
- Adding "overload;" after the second constructor won't compile. "[Error] test.pas(44): Declaration of 'Create' differs from previous declaration".
- making the second constructor a class function compiles without any errors or warnings, but dies with an access violation at runtime (all member vars are nil).