c++ - Ostream << operator overloading and it's return type -



c++ - Ostream << operator overloading and it's return type -

i learnt how operator overloading of stream insertion operator. 1 uncertainty remains.

#include<iostream> class int { int i; friend std::ostream& operator<<(std::ostream&,int&); public: int():i(100){} }; std::ostream& operator<<(std::ostream& obj,int & data) { obj<<data.i; homecoming obj; } int main() { int obj; std::cout<<obj; }

what significance return obj; has?

do return have utilize further?

are forced return because of syntax of operator<< without usefulness?

remember how can write code this:

cout << "the info is: " << somedata << endl;

this same as:

((cout << "the info is: ") << somedata) << endl;

for work, << operator has homecoming stream.

c++ operator-overloading

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -