Can you explain the order of execution in the constructor initialization list?
Answer:
When a class object is created using constructors, the execution order of constructors is:
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Answer:
When a class object is created using constructors, the execution order of constructors is:
- Constructors of Virtual base classes are executed, in the order that they appear in the base list.
- Constructors of nonvirtual base classes are executed, in the declaration order.
- Constructors of class members are executed in the declaration order (regardless of their order in the initialization list).
- The body of the constructor is executed.
need an explanation for this answer? contact us directly to get an explanation for this answer