i have searched many sources about initialization lists but i can't find a useful source . can't understand what it is and for what it is used .Can Anybody explain it in details or show me a good source? i read from http://www.cprogramming.com/tutorial...lists-c++.html
but couldn't understand
moreover can you explain that code step by step with all details(i dont know copy constructors and assignment operators)..Please don't pass any point .Thanks.
Code:struct Base { int x; Base ( int y, int z ) : x ( y+z ) { // list above is the same as x=y+z; but it calls the constructor for x instead of the assignment operator } }; struct Derived : public Base { double d; Derived ( int y, double d ) : Base ( x, 5 ), d ( d ) { // Above calls Base constructor and initializes d // Notice that the d outside parentheses is the struct member, // the one inside parentheses is the constructor parameter } }



LinkBack URL
About LinkBacks


