为什么形参is不能直接输入到*this里

C++语言 码拜 8年前 (2016-05-30) 810次浏览
为什么形参is不能直接输入到*this里为什么形参is不能直接输入到*this里
[Error] cannot bind “std::istream {aka std::basic_istream<char>}” lvalue to “std::basic_istream<char>&&”
解决方案

20

this是对象指针,*this代表什么呢?莫非隐含认为是第一个成员变量?

20

类T的成员函数中,*this 代表对象本人
假如类 T 没有定义
友元函数 std::istream& operator >>(std::istream& ,T & );
那么  is>> *this 就不好处理了

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明为什么形参is不能直接输入到*this里
喜欢 (0)
[1034331897@qq.com]
分享 (0)