What is it that causes func2() to be called before func1() in the above sample ? Is this as per the C++ specification ?Code:#include "stdafx.h" int func1() { printf("Initializing i\n"); return 10; } int func2() { printf("Initializing j\n"); return 20; } class A { private : int j; int i; public: A():i(func1()),j(func2()) { } }; int _tmain(int argc, _TCHAR* argv[]) { A a; return 0; }
Can you please outline the process of execution of the constructor and creation of data members during object construction ?




Reply With Quote