real

constexpr double real() const noexcept

Gets the real component x.

Returns

double

A real number.

Gets the real component of the complex object.

Example

Complex z(1, 4);
std::cout << z.real() << "\n";

Output:

1