ostream

4 views
Skip to first unread message

jyothi...@gmail.com

unread,
Apr 24, 2023, 9:07:44 AM4/24/23
to noc23-cs5...@nptel.iitm.ac.in
Hi,

I have a question about what is happening in this video at 00:19:02 -

http://www.youtube.com/watch?v=_Mb9NbkNVcA#t=1142s.

do we use ostream always if we want to overload cout? can we use other names too? why it is passing with &? cant we use * instead?.

Thanks!



Reference Key - Key('StudentQuestionEntity', 6598093517094912, namespace='ns_noc23_cs50')

soumen paul

unread,
Apr 26, 2023, 2:49:03 AM4/26/23
to Discussion forum for Programming in Modern C++, jyothi...@gmail.com
Yes. Because cout is a function which returns takes parameter and returns ostream class type object reference. As it is returning a reference and taking a reference type object, we need to mention &. Therefore, * will not work as it is used for pointer.
Reply all
Reply to author
Forward
0 new messages