Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

return type of operator "cout"

206 views
Skip to first unread message

Raman

unread,
Jan 30, 2008, 7:16:33 AM1/30/08
to
Hi All,

Could you please tell me what is the return type of "cout"?


Thanks in Advance.

Regards,
-Raman Chalotra

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Dave Seaman

unread,
Jan 30, 2008, 9:04:00 AM1/30/08
to
On Wed, 30 Jan 2008 06:16:33 CST, Raman wrote:
> Hi All,

> Could you please tell me what is the return type of "cout"?


Functions have return types; "cout" is a std::ostream object, not a
function.

--
Dave Seaman
Oral Arguments in Mumia Abu-Jamal Case heard May 17
U.S. Court of Appeals, Third Circuit
<http://www.abu-jamal-news.com/>

int...@gmail.com

unread,
Jan 30, 2008, 1:32:00 PM1/30/08
to
On 30 Jan, 15:16, Raman <ramanchalo...@gmail.com> wrote:

> Could you please tell me what is the return type of "cout"?

If you mean the type of cout itself, then it's not a function, but a
global variable of type std::ostream. If you mean the type of
expression like (cout << 5), then it's std::ostream&, and the value is
a reference to cout itself, which is why you can chain operator<< on
it.

ManicQin

unread,
Jan 31, 2008, 4:29:16 AM1/31/08
to
On Jan 30, 4:04 pm, Dave Seaman <dsea...@no.such.host> wrote:
> On Wed, 30 Jan 2008 06:16:33 CST, Raman wrote:
> > Hi All,
> > Could you please tell me what is the return type of "cout"?
>
> Functions have return types; "cout" is a std::ostream object, not a
> function.

{ Edits: quoted signature & clc++m banner removed. Please don't quote
them. -mod }

It depends Are you referring to cout as an object (std::ostream) ? or
are you referring to "cout <<" which is the object + an overloaded
opeartor that in this case returns std::ostream&

--

0 new messages