C++ 有关复数通过成员函数实现重构运算符 及 友元函数重载运算符
#include
using namespace std;
class Complex
{
private:
float _real;
float _imag;
public:
Complex(float real = 1, float imag = 1) :_real(real), _imag(imag) {}//构造函数
Complex(const Complex& complex);//拷贝构造函数
~Complex() {};//析构函数
Complex operator-(const Complex& complex);
Complex& operator-=(const Complex& complex);
Complex& operator*=(const Complex& complex);
Complex& operator/=(const Complex& complex);
Complex& operator++();//
共有 0 条评论