#ifndef __Complex__
#define __Complex__
class Complex
{
public:
Complex(double real = 0, double image = 0,const char * name = nullptr);
virtual ~Complex();
Complex(const Complex&com);
Complex& operator=(const Complex &com);
Complex& operator+=(const Complex &com);
double Real() const;
double Image() const;
private:
double _real;
double _image;
char * _name;
};
#endif
#include "Complex.h"
#include "string.h"
Complex::Complex(const double real, const double image, const char *name)
:_real(real), _image(image)
{
if (name)
{
size_t len = strlen(name) + 1;
_name = new char[len];
strcpy_s(_name, len, name);
}
else
{
_name = new char[1];
*_name = '