So let's say I have the following class:
namespace Example { class Bar {}; }
Now, if I want to overload the operators for the Bar class, 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 have to do one of the above, please write an explanation of why this should be done this way.
PS /*.....*/ just means the body of functions (omitted for simplicity)
source share