主题:[原创]C++中运算符重载的问题
#include <iostream.h>
class complex
{
public:
complex() {real=image=0;}
complex(double r, double i)
{real=r;image=i;}
complex operator +(const complex &c);
complex operator -(const complex &c);
complex operator *(const complex &c);
complex operator /(const complex &c);
friend void print(const complex &c);
private:
double real,image;
};
以下略
complex operator +(const complex &c); 这里将+重载后面又出现c是什么意思啊
这里的+重载有什么意义?
谢谢各位,我真的是看的很晕啊
class complex
{
public:
complex() {real=image=0;}
complex(double r, double i)
{real=r;image=i;}
complex operator +(const complex &c);
complex operator -(const complex &c);
complex operator *(const complex &c);
complex operator /(const complex &c);
friend void print(const complex &c);
private:
double real,image;
};
以下略
complex operator +(const complex &c); 这里将+重载后面又出现c是什么意思啊
这里的+重载有什么意义?
谢谢各位,我真的是看的很晕啊