Just to show why we would use member initializers, say we have a class declared as
follows with a string variable and a constructor:
#include <string>using std::string;class Name{ private: string name; public: Name( string & n ) { this->name = n; }};
When the object is first created (before the body of the constructor is called) C++ will call the default constructor for the member variable 'name'. This happens for all non-primitive types (objects) that are members of a class.
Then you are assigning the parameter 'n' to this variable later on too. So essentially you are initializing the same variable twice, which is slightly inefficient.
Using the member initializer however, bypasses this default initialization of 'name':
#include <string>using std::string;class Name{ private: string name; public: Name( string & n ) : name(n) { }};
Now 'name' is initialized with the value 'n' before the constructor is called, and default constructor for 'name' is not called. So you have saved one assignment to name in the constructor and made your constructor code more efficient.