string name;
cout<< name << endl;
Will the above statement display an object?
I was told that object. (class data member)
But here we are passing direct to a string object. And It works too. How?
Printable View
string name;
cout<< name << endl;
Will the above statement display an object?
I was told that object. (class data member)
But here we are passing direct to a string object. And It works too. How?
Because string comes with an operator overload for << to do what you think it ought to.
operator<< (string) - C++ Reference