> Is it possible to have a constructor for the parent class that receives a
> parameter which determines the type of child that is instantiated in it's
> place?

You should be able to find out the actual class of the instance during
instantiation... self.ClassType should return the class reference... So

TBaseClass = class(TObject)
public
    constructor Create; virtual;
end;

TDescendant = class(TBaseClass)
public
    constructor Create; override;
end;

implementation

constructor TBaseClass.Create;
begin
    ShowMessage('The actual class is '+Self.ClassName);
end;

constructor TDescendant.Create;
begin
    inherited Create;
    // Whatever you like in here
end;

I have no idea why it would matter at this point...

--
Aaron Scott-Boddendijk
INTAZ Limited
+64 7 838 3371 Voice
+64 7 838 3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to