前置++与后置++运算符重载,前置--与后置--运算符同理
complex& operator++(complex& c1) { c1.a++; c1.b++; return c1; } complex& operator++(complex& c1, int)//占位符区分前置还是后置 { complex temp = c1; c1.a++; c1.b++; return temp; }
原文地址:https://www.cnblogs.com/jly594761082/p/10584155.html
时间: 2024-11-09 02:58:01