I have the following classes
class abc
{
private:
string name_;
public:
explicit abc(string name);
};
class xyz
{
private:
abc obj_abc_;
public:
xyz ():obj_abc_("NOTHING") { }; //I think this should give an error since explicit is used.
};
According to what i have understood about explicit, i should be getting a compiler error whenever xyz constructor is being called; because i am initializing the obj_abc by simply assigning it to a string. But i am not getting any compiler error here. What am i missing?
explicit abc(string name):name_(name);This compiled?