how >> operator on streams returns a reference to itself
Say I've a class
class A{
A& operator+ (size_t ofst)
{
//some calculation
//return
}
};
here i cannot write
return this;
becuse A* cannot be converted to A&. So how to achieve this this? I want
to return a reference not a pointer.
As an analogy there is >> or << operator for a stream class. As i know
these two returns a reference to itself. How standard library achieves
this?
No comments:
Post a Comment