S
Sunny
The way to overload operator << is : ostream& operator << (ostream&
os, const Obj& obj);
and this is a member function.
My question is why do we need to provide a const reference of Obj as
argument when it is a member function and its members accessible
through this pointer ?
Isnt cout << obj;
equivalent to obj.operator<<(cout) ?
Thanks
os, const Obj& obj);
and this is a member function.
My question is why do we need to provide a const reference of Obj as
argument when it is a member function and its members accessible
through this pointer ?
Isnt cout << obj;
equivalent to obj.operator<<(cout) ?
Thanks