aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/complex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/tests/libsample/complex.cpp')
-rw-r--r--sources/shiboken6/tests/libsample/complex.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/libsample/complex.cpp b/sources/shiboken6/tests/libsample/complex.cpp
new file mode 100644
index 000000000..e3bec9aae
--- /dev/null
+++ b/sources/shiboken6/tests/libsample/complex.cpp
@@ -0,0 +1,24 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#include "complex.h"
+
+#include <iostream>
+
+Complex::Complex(double real, double imag) noexcept
+ : m_real(real), m_imag(imag)
+{
+}
+
+Complex Complex::operator+(const Complex &other)
+{
+ Complex result;
+ result.setReal(m_real + other.real());
+ result.setImaginary(m_imag + other.imag());
+ return result;
+}
+
+void Complex::show() const
+{
+ std::cout << "(real: " << m_real << ", imag: " << m_imag << ")";
+}