Its equivalent to
CRemoteDemo::CRemoteDemo(EDemoSetup eDemoSetup)
{
m_eDemoSetup = eDemoSetup;
m_pActiveGroup = NULL;
m_pPopupGroup =NULL;
}
No it's not. The first will call the constructor m_eDemoSetup
with eDemoSetup; the second will call the default constructor of
m_eDemoSetup, then call the assignment operator with eDemoSetup.
It's a major difference.
You can always choose between "the ordinary way" or "member
initialization list way" of initializing variables.
No. In practice, you almost always want to (and very often have
to) use initialization lists.
But in some cases you can initialize variables using "member
initialization lists" only.
Those cases are:
1. const members
2. reference members
3. instances of classes whose constructor requires arguments for
initialization
Case three covers a lot of ground, don't you think?
Another obvious case is if the object doesn't support
assignment. And of course, for base classes.
For non-class types, it's generally considered preferable to use
initialization lists so that the object will be initialized
before you enter into the constructor body (which reduces the
chances of accidentally using it before it is initialized.