Do initialization lists get called before or after the function logic.
1 2 3 4 5 6 7 8 9 10 11 12 13
template <class T>
myAnimal::myAnimal(const myAnimal & rhs) : legs(rhs.legs), eyes(rhs.eyes)
{
if(legs < 6) { // I want legs == rhs.legs
// Do stuff
}
}
// I'm scared rhs.legs == legs only after the function logic.
Also note that the variables are initialized in the order they are defined in the class definition and not in the order they are listed in the initialization list.
Also note that the variables are initialized in the order they are defined in the class definition and not in the order they are listed in the initialization list.