void operator<< (const Integer& left, const Integer& right)
{
cout << "\n: " << right.i;
}
can be accessed like:
Integer obj;
obj << 5 << 3 << 2;
Fine:
But qDebug works like qdebug() << 2;
Which means that the left operand of << operator is a function.
What should be the syntax of a user defined function so that I can write:
myfunc() << 2;
The left operand is not a function, it is the value the function returns. Specifically,
qDebug()returns an instance ofQDebug, which has some 20 overloads of<<defined.