In-class Initialisation of Data Members
In C++03, only const static members of integral type can be initialised directly in the class. C++11 allows members to be initialised in-class. class Test { public: const static int x = 0; // C++03 int y = 0; // C++11 only }; We can also initialise objects e.g. strings: class Test { public: std::string … Read more