Q:

Can you explain the order of execution in the constructor initialization list in c++?

0

Can you explain the order of execution in the constructor initialization list?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

total answers (1)

C++ Interview Questions For Experienced

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What is the conversion constructor in c++?... >>
<< Can we make a copy constructor private in c++?...