How do C++ class members get initialized if I don’t do it explicitly?

In lieu of explicit initialization, initialization of members in classes works identically to initialization of local variables in functions. For objects, their default constructor is called. For example, for std::string, the default constructor sets it to an empty string. If the object’s class does not have a default constructor, it will be a compile error … Read more