I thought that in
cout << "Hello world"
cout
object has an operator overloading so we can pass strings
into cout
objects member function.
But in some example code I saw a class which has an operator overloading defined in it.
class GenericPlayer : public Hand
{
..
friend ostream& operator <<(ostream& os, const GenericPlayer& aGenericPlayer);
..
};
...
cout << aGenericPlayer << endl;
...
Even if it is not, what if both cout
and aGenericPlayer
overload operator<<
?