# includeiostreamusingnamespacestd; //2021年10月12日08:52:38晴//今天学运算符超载,先是无知,再是惊叹,但学过单眼运算符超载时,哑然//然后,涌起一种失落感,我想//C为什么这么I,I,还有天理呢? 王法也有殡三观//C是邪恶的语言,虚拟世界的东西完全不相信classint{public:int(intI=0)。 ~Int (; void Show (; Int operator (; 输入操作器(int; 私有:英寸I; (; int:3360int(intI ) {this-i=i; }void Int:Show () cout )='Iendl; (}Int Int:operator )//单眼运算符前置) {Int temp; this-i=this-i 1; temp.i=this-i; 返回时间; (intint:3360operator(int ) /单眼运算符后置) {Int temp; temp.i=this-i; this-i=this-i 1; 返回时间;//返回一个Int对象并为另一个Int赋值(}Int:~Int () {}int main ) ) inta )0)、b、c )0)、d ); //b=a; b=a.operator(1000; //i :单眼算子后置//d= c; d=c.operator (; // i:单眼运算符前置cout 'a '; a.Show (; 计数' b '; b.Show (; 计数' c '; c.Show (; cout 'd '; d.Show (; 返回0; }