constructor

constexpr Complex() noexcept
constexpr Complex(const double x) noexcept
constexpr Complex(const double x, const double y) noexcept
constexpr Complex(const Complex &z) noexcept
template<class T>
constexpr Complex(const std::complex<T> &z) noexcept

Instantiates an object for the Complex class.

Parameters

const double x

A real number, the real argument.

const double y

A real number, the imaginary argument.

const Complex &z

A complex number.

const std::complex<T> &z

A standard C++ complex number.

Initializes a Complex object with real and imaginary components. If unspecified by the user, the respective component will be set to \(0\).

Example

std::cout << Complex(5, 4) << "\n";

Output:

5 + 4j