In our previous episode, Xiangrong Fang said: > I would like to know the benefit of making constructor / destructor > virtual. As described here: > > http://c2.com/cgi/wiki?VirtualConstructor > > The benefit of virtual constructor seems related to "class reference". As > far as I understand, it is related to how LCL works, like: > > CreateComponent(AComponent: TComponentClass); > > My questions are: > > 1) if the above understanding is correct AND COMPLETE, why the constructor > of TObject is not virtual? What problem will appear IF we make it virtual?
> 2) What is the purpose of making destructor of TObject virtual? I think you are thinking in the right direction, parameters is the reason. This means that a framework that wants two or differently typed parameters to the constructor can introduce its own deepest level constructor. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal