I have written a class for a curve in the complex plane in c++. It looks like this,
#ifndef CURVE_H
#define CURVE_H
#include <iostream>
#include "complex_numbers.h"
class Curve {
double min;
double max;
Complex(*f)(double);
public:
Curve(Complex(*g)(double), double min_t, double max_t) {
f = g;
min = min_t;
max = max_t;
if (min > max) {
std::cout << "Domain error." << std::endl;
}
}
double get_min();
double get_max();
Complex at(double t);
};
#endif
This also relies on another class I have written (Complex) which is just a simple class for the complex numbers.
If a curve is defined on the interval [a,b], I don't want a curve with b<a to be able to be defined. Can I prevent this in my constructor somehow? As of right now I'm printing an error message but I can still define a curve (f,1,0) for example. Can I cancel the initialization in some way, if min_t > max_t
?