Are C++ constructors called pre-initialization? -
suppose declare a
of type type
:
type a;
question: type
constructor a
called @ point? or after initialize a
constructor called?
is type constructor called @ point? or after initialize constructor called?
you are initializing a
here, whether explicitly provided value process or not.
there no opportunity initialise a
"later"; can assign later. (early c texts talk "initialising" numeric values long after declaration, that's different language, different century, , different set of descriptive idioms.)
so, yes, constructor called object's lifetime begins. that's either right there , then, on line, or if class member of course it's when encapsulating class being initialised , it's member's turn.
of course have proven simple std::cout
pair.
Comments
Post a Comment