I may have left the left margin with this question, but is it possible to define a member function through the constructor?
In my case, I am trying to write a class to perform a robust fit of a model (using RANSAC ). I want this to be generalizable to different types of models. For example, I could use this to determine a plane estimate for a set of three-dimensional points. Or perhaps I could define a transformation between two sets of points. In these two examples, different error functions and different fitting functions may be required. Instead of using a class, a static function call might look like
model = estimate(data, &fittingFunc, &errorFunc);
I am wondering if I can have a member instance for these modular functions?
Sort of
class Estimator
{
private:
double errorFunc(std::vector<dtype>, double threshold);
double fittingFunc(std::vector<dtype>, Parameters p);
public:
Estimator(void (*fittingFunc(std::vector<dtype>, Parameters), void (*errorFunc(std::vector<dtype>, double));
dtype estimate(data);
};
Estimator::Estimator(void (*fittingFunc(std::vector<dtype>, Parameters), void (*errorFunc(std::vector<dtype>, double))
{
fittingFunc = fittingFunc;
errorFunc = errorFunc;
}
, , , . : -?
-, , ?
UPDATE: , MATLAB , , ++