Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/138.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ C+中的运算符重载+;_C++_Oop_Operator Overloading - Fatal编程技术网

C++ C+中的运算符重载+;

C++ C+中的运算符重载+;,c++,oop,operator-overloading,C++,Oop,Operator Overloading,我有一个按位构造运算符重载的赋值。我试图以创建运算符的方式构造运算符,它试图重新定义使用两个整数左移的含义,而不是对类。你想要这样的东西: friend int operator<<(const bitwise& , int); friend int运算符这是规则。您只能重载用户定义类型的运算符。谢谢,我理解您的意思。谢谢,我刚刚完成。但我在我的文件里读到了“operator@NguyenVanBinh:只要T不是内置类型,这是正确的。好的,我理解。非常感谢。 friend

我有一个按位构造运算符重载的赋值。我试图以创建运算符的方式构造运算符,它试图重新定义使用两个整数左移的含义,而不是对类。你想要这样的东西:

friend int operator<<(const bitwise& , int);

friend int运算符这是规则。您只能重载用户定义类型的运算符。谢谢,我理解您的意思。谢谢,我刚刚完成。但我在我的文件里读到了“operator@NguyenVanBinh:只要
T
不是内置类型,这是正确的。好的,我理解。非常感谢。
friend int operator<<(const bitwise& , int);