[comp.lang.c++] Virtual constructor?

al@well.sf.ca.us (Alfred Fontes) (05/24/91)

Sometimes, I wish that the constructor for a base class didn't necessarily
have to be called before the constructor for a derived class.  Has the idea
of not calling a base-class constructor been discussed before, and is there
any expectation of seeing this in future versions of C++?

Al Fontes, Jr.
-- al@well.sf.ca.us --
-- uunet!apple!well!al --

pete@borland.com (Pete Becker) (05/29/91)

In article <25002@well.sf.ca.us> al@well.sf.ca.us (Alfred Fontes) writes:
>Sometimes, I wish that the constructor for a base class didn't necessarily
>have to be called before the constructor for a derived class.  Has the idea
>of not calling a base-class constructor been discussed before, and is there
>any expectation of seeing this in future versions of C++?

    The fundamental assumption about classes in C++ is that you cannot access
a class until it has been constructed.  That's a trememdous aid to writing
correct code!  I agree that there are times when it would be handy to get
around this rule, but I try to push such thoughts aside.  The loss of object
security would be too high a price.