blob: 9e93c961ce6d02ea2618c640fb9a2aa61c184259 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <iostream>
#include "complex.h"
using namespace std;
Complex::Complex(double real, double imag)
: m_real(real), m_imag(imag)
{
// cout << __PRETTY_FUNCTION__ << "[real=0.0, imag=0.0]" << endl;
}
Complex
Complex::operator+(Complex& other)
{
Complex result;
result.setReal(m_real + other.real());
result.setImaginary(m_imag + other.imag());
return result;
}
void
Complex::show()
{
cout << "(real: " << m_real << ", imag: " << m_imag << ")";
}
|