One of the golden rules in C++ is that the life-time of an instance begins when its constructor completes successfully and ends when its destructor begins.
From this rule we conclude that it is NOT a good idea to call virtual methods in a constructor as the possible derived instance is not valid which would lead to undefined behavior.
The Virtual Constructor Idiom as mentioned in C++ FAQ 20.8 seems to indicate the contrary.
My question is:
- What is the exact definition in the standard for defining the life time of objects relative to calls from their constructors and destructors?
- and furthermore is the So called "Virtual Constructor Idom" valid?