15.5k views
1 vote
Suppose you have a programmer-defined data type Data and want to overload the << operator

to output your data type to the screen in the form cout << dataToPrint; and allow
cascaded function calls. The first line of the function definition would be
(a) ostream &operator<<(ostream &output, const Data &dataToPrint)
(b) ostream operator<<(ostream &output, const Data &dataToPrint)
(c) ostream &operator<<(const Data &dataToPrint, ostream &output)
(d) ostream operator<<(const Data &dataToPrint, ostream &output)

User Krii
by
4.9k points

1 Answer

3 votes

Answer:

(a) ostream &operator<<(ostream &output, const Data &dataToPrint)

Step-by-step explanation:

If you have a programmer-defined data type Data and want to overload the << operator to output your data type to the screen in the form cout <<dataToPrint; and allow cascaded function calls.

The first line of the function definition would be;

ostream &operator<<(ostream &output, const Data &dataToPrint)

User Crakama
by
4.5k points