重载输入流运算符>>必须使用的原型为

admin2010-03-29  28

问题 重载输入流运算符>>必须使用的原型为

选项 A、istream& operator >> (istream&,<类名>&);
B、istream& operator >>(istream,<类名>);
C、istream operator>>(istream,<类名>&);
D、<类名>operator >>(istream &,<类名>&);

答案1

解析 本题考核运算符的重载。C++中重载输入流运算符>>和输出流运算符<<只能作为非类成员函数重载,且必须使用如下原形:
istream& operator >>(istream&, <类名> &);
ostream& operator <<(ostream&, <类名>);
转载请注明原文地址:https://kaotiyun.com/show/4hjp777K
0

最新回复(0)