C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 12)
12.
cout is a/an __________ .
operator
function
object
macro
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
52 comments Page 1 of 6.

Java Mari said:   7 years ago
We have already known operator means it will be performed some kind of operations between two are more operands. likewise here ,,"cout " perform an input operation by using the symbol ">>" but the same time it is an object.

How it is possible?

Because cout is a object for (derived class or sub class) ostream .and it's main class is "iostream.h" so the answer is (c) OBJECT.

Rajasekhar said:   10 years ago
<< is an operator which can print data on a console.

"<<" is an operator that can be overloaded in such a way that can print data on console in ostream class.

cout is an object, when ever cout << "Raja sekhar"; executes.

Compiler class as cout.operator<< (.).

Rahul said:   7 years ago
Std::cout and std::cin are global objects of classes std::ostream and std::istream, which they've overloaded operator << and >>. You should read about operator overloading. The Cout is the object of type ostream. Cin is the object of type istream.
(2)

Manoj Kumar Patel said:   7 years ago
In C programming language, We consider printf and scanf to be functions. when it comes to cout and cin, in C++ what are they?

I mean they cant be functions as they are not followed by parenthesis, so they are not functions .cout is an object of the class.

Chandan said:   1 decade ago
Object is the simple variable of a class. So if we will open <iostream> header then we can found the statement.

Extern ostream cout; means cout is the variable of ostream class so. For this reason it is an object.

Sandesh said:   1 decade ago
cout is a object and not a function. cout is an output stream object that refers to the monitor whereas cin refers to the keyboard.Both are defined in the header file <iostream.h>

Gaurav Singh said:   7 years ago
The cout is an object of class ostream that represents the standard output stream oriented to narrow characters (of type char). It corresponds to the C stream stdout.

Divya said:   7 years ago
In c++, iostream is the header file, which contains i stream and o stream, jectathis two are objects, so cin is istream object and cout is ostream object.

Naman said:   9 years ago
Object of class ostream that represents the standard output stream oriented to narrow characters (of type char). It corresponds to the C stream stdout.

Rohini said:   10 years ago
cout is an object because it is an object of ostream and we use the header file <iostream> here. It allows both input and output operations.


Post your comments here:

Your comments will be displayed after verification.