全部题库 / C++ / 试题详情
单选题 C++
2013-08-06

重载输人流运算符>>必须使用的原型为(  )。

A.istream&operator>>(istream&,<类名>&);
B.istream&operator>>(istream,<类名>);
C.istreamoperator>>(istream,<类名>&);
D.<类名>operator>>(istream&,<类名>&);

参考答案

D

答案解析

A。【解析】C++流的输入运算符“>>”和输出运算符“<<”只能作为非成员函数重载。重载输入流运算符“>>”须使用的原型是istream&operator>>(istream&,<类名>&);。

你可能感兴趣的试题