aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libsample/complex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libsample/complex.cpp')
-rw-r--r--tests/libsample/complex.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/libsample/complex.cpp b/tests/libsample/complex.cpp
new file mode 100644
index 000000000..9e93c961c
--- /dev/null
+++ b/tests/libsample/complex.cpp
@@ -0,0 +1,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 << ")";
+}
+
+