+ 3
Cout and Cin is an object of which class?
I tackled one question in a challenge... that The 'cout' is an object of which of the following classes? a) iostream b) ostream c) istream d) ifstream the correct answer given was 'ostream'? please explain me if cout is a class of ostream (not iostream) then why don't we include ostream while writing simple program like 'Hello World'? similarly, please tell me 'cin' is an object of which class?
4 odpowiedzi
+ 16
std::cout and std::cin are globalobjects of classes std::ostream and std::istream respectively,
which they've overloaded operator << and >> .
You should read about operator overloading.
cout is object of type ostream.
cin is object of type istream.
To use both we use iostream
iostream -> input/output stream
istream -> input stream //cin belongs
ostream -> output stream...//cout belongs
+ 13
Suraj Yes u can say that
check this link 👇
https://stackoverflow.com/questions/9266990/iostream-vs-ostream-what-is-different
+ 3
🌛DT🌜
please tell me...
does it mean when we include iostream... we indirectly includes istream as well as ostream at the same time?
+ 1
thank you so much bro..☺