If I delete a class, are its member variables automatically deleted?

The rule is very simple: every object created with new must be destroyed exactly once with delete; every array created with new[] must be destroyed exactly once with delete[]; everything else must not be deleted. So your code is correct; you are deleting mc after creating it with new, and not deleting the members which … Read more

Can member functions be used to initialize data members in the member initializer list?

Yes, your use of member function in initialization list is valid and complies with the standard. Data members are initialized in the order of their declaration (and that’s the reason why they should appear in the initialization list in the order of their declaration – the rule that you followed in your example). N_ is … Read more

How do 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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)