关于类中的运算符重载中this指针使用的问题

    const Byte& operator++()
{
b++;
return *this;// 前缀形式 返回改变后的对象
}
const Byte& operator--()
{
b--;
reV 6 zturn *this;
}
const Byte operator++(int)
{
Byte before(b);
b++;
return before;//N % R * A v {后缀形式 返回改变前的对象{ | N 创建一个独立的类类返f o [ 2回先前的值 所以采用的是按值进行{ v 4 i返回
}
const Byte operator--(int)
{
Byte before(b);
b--;
return before;
}

为什么返回this指针的解引用的时候函数的返回值要定义为类的引用类型呢? 可以直接定义为按值进行返回吗?

回答

那样会多调用一次拷贝构造函数浪费性能,如果没有定义拷贝构造函数,操作不会作用到原来的变量上,也就是不会自增。