C ++ variable initialization timing member

code show as below:

 

Note my break point position.

The final result:

 

In the program enters MyTest () the function body before, the console will print out I have been constructed.

Namely: entering the constructor function body before the member variables in the class has been initialized up!

 

Guess you like

Origin www.cnblogs.com/XiaoXiaoShuai-/p/11421840.html