I have a few questions about class.
- Does every class need to have "private" members? It seems that the private members are used in initialization. If no initialization is needed, then maybe they are not needed...
- in this example
class A
{
public:
A()
{ cout << "A" << endl;
}
};
class B
{
public:
B()
{ cout << "B" << endl;
}
};
class C
{
public:
C()
{ cout << "C" << endl;
}
private:
A myA; //can we use class as a data type?
B myB;
};
int main ()
{
C c;
}
Why the output would be
A
B
C
---------------------Thank you--------------------