C++: Construction and initialization order guarantees

前端 未结 5 452
南笙
南笙 2020-12-03 11:14

I have some doubts about construction and initialization order guarantees in C++. For instance, the following code has four classes X, Y, Z

5条回答
  •  广开言路
    2020-12-03 11:45

    1) First of all, it is needed to calculate the arguments.

    2) Then base classes are constructed.

    3) Then members are constructed in the order of appearance in the declaration of the class.

    4) Then Constructor of X is called

提交回复
热议问题