a++函數
++athis
++有2種方式,那麼在重載++的時候要怎麼區分:spa
前置:co
T& operator++(){return
do something參數
return *this;opera
}const
後置:
const T operator++(int){
T tmp = *this;
++(*this);
return tmp;
}
區別主要在:
1.返回值
2.函數參數