Following is a fancy code:
class B
{
private:
int sum;
public:
B ()
{
sum = 0;
}
B& add (int number)
{
sum =+ number;
return *this;
}
};
int main ()
{
B obj;
obj.add (1).add (2).add (3). add (4);
}
Fine, what are the “serious” uses of returning the this pointer from a function call?
An example would be;
You really want to return this to be able to chain to;