So let's say I have the following class :
namespace Example
{
class Bar {};
}
Now in case I want to overload the operators for the class Bar
, should I do :
namespace Example
{
class Bar {};
ostream& operator<<(ostream& os, const Bar& b)
{/*..........*/}
}
or should I do :
namespace Example
{
class Bar {};
}
ostream& operator<<(ostream& os, const Example::Bar& b)
{/*..........*/}
If I'm supposed to do either of the above, please post the explanation for why it should be done that way.
P.S. /*.....*/
simply means the body of the functions(omitted for simplicity)