Inicialice los miembros de clase en el mismo orden en el que
se han declarado.
class MyClass {
public:
MyClass
(char
*nameInput, int twoInput, int threeInput);
private:
char *one;
int two,
three;
int four;
};
MyClass::MyClass (char
*nameInput, int twoInput, int threeInput) : one(nameInput), two(twoInput), three(threeInput), four(twoInput + threeInput)
{
}
|
|