摘要
C++类的运算符重载时,由于其返回类型比C++内置的用于基本数据类型的运算符的返回类型复杂,导致C++原有的左值/右值规则遭到破坏。当使用类的重载运算符构造表达式时,需要避免构造过于复杂的表达式,以免造成表达式的数据混乱;或者不去重载那些容易使左值/右值规则遭到破坏的运算符,对类的对象禁用那样的运算符。
When operator of the class C++ overloads, because its return class is much more complex than that of the operator used for the basic data installed in C++, original lvalue or rvalue of C++ is damaged. When class overloading operator is used to construct expression, complicated expressions are avoided in order not to confuse its data; or the operator that damages easily the lvalue or rvalue rule is not overloaded, and such operator is forbidden to the object of the class.
出处
《电脑开发与应用》
2008年第2期5-7,共3页
Computer Development & Applications
关键词
运算符重载
左值
右值
运算规则
C++
operator overloading, lvalue
rvalue, operator ruler C++