#includeusing namespace std;class Complex{private: double real,imag;public: Complex(double r=0,double i=0):real(r),imag(i){} operator double(){return real;} //返回类型为重载类型 //double n=2+c; //double n=2+c.operator double();}
本文共 311 字,大约阅读时间需要 1 分钟。
#includeusing namespace std;class Complex{private: double real,imag;public: Complex(double r=0,double i=0):real(r),imag(i){} operator double(){return real;} //返回类型为重载类型 //double n=2+c; //double n=2+c.operator double();}
转载于:https://www.cnblogs.com/-Asurada-/p/10731719.html