Y
Yakov Gerlovin
Hello,
I'm trying to find what exactly the standard says about calling of
virtual function from constructor, but couldn't find anything specific
in the standard. (I'm looking at ISO 14882, first edition 1998-09-01)
In 10.4 (Abstract classes) par 6 it says
"Member functions can be called from a constructor (or destructor) of
an abstract class; the effect of making a virtual call (10.3) to a
pure virtual function <...> for the object being created (or
destroyed) from such a constructor (or destructor) is undefined"
That implies that according to standard, calling not pure virtual
function in constructor is OK, but I'd like to see the explicit
statement if there is one.
Thank you for your help.
P.S.
This is strictly for purpose of academic discussion (and I did tests
on several compilers and platforms)
The question is what the standard says and not about how compilers
implements this case
I'm trying to find what exactly the standard says about calling of
virtual function from constructor, but couldn't find anything specific
in the standard. (I'm looking at ISO 14882, first edition 1998-09-01)
In 10.4 (Abstract classes) par 6 it says
"Member functions can be called from a constructor (or destructor) of
an abstract class; the effect of making a virtual call (10.3) to a
pure virtual function <...> for the object being created (or
destroyed) from such a constructor (or destructor) is undefined"
That implies that according to standard, calling not pure virtual
function in constructor is OK, but I'd like to see the explicit
statement if there is one.
Thank you for your help.
P.S.
This is strictly for purpose of academic discussion (and I did tests
on several compilers and platforms)
The question is what the standard says and not about how compilers
implements this case