Although I'm into Delphi for a couple of years I'm still a little bit confused about the Delphi object stuff. As far as I know (and maybe I'm wrong) a constructor has to do the following:
- Allocate memory for the member variables
- Execute code of the "constructor procedure"
- Do some VMT stuff
And here my problem goes:
Assume you have a base type TBaseClass and a derived type TMyClass. This leads to something like
You have to get memory for the members of TBaseClass and the members of TMyClass. Dito for the VMT. What happens to the members and VMT of the base class if you do it like this
And what about that:
myVar_1 := TMyClass.Create;
myVar_2 := myVar_1.Create;
What if the constructors are virtual?
I hope you've understood what I'm asking for. If there is more than one good comments I will provide more points in an extra thread!
Thank you in advance!