c++学习2011-03-09

来源:互联网 发布:元首最广为人知的cp 编辑:程序博客网 时间:2024/06/06 07:26

背景:
<string.h>

 

源代码:

 

错误提示:
error C2679: binary '<<' : no operator defined which takes a right-hand
 operand of type 'class std::basic_string<char,
struct std::char_traits<char>,class std::allocator<char> >' (or there is no accepta


错误分析:
与你定义的操作符“>>”右边的操作数类型不匹配
二进制“operator”: 没有找到接受类型“type”的右操作数的运算符(或没有可接受的转换)

 

研究结果(知识扩展):
把其中的 “.h”去掉,则错误消失,能够正常运行!
cout<<xxx.rch()<<endl;看看,rch是方法

原创粉丝点击