getX

constexpr double getX() 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.getX() << "\n";

Output:

1