I have a class hierarchy in which the base class is abstract. Each derived class has a set of private members which describe parameters that control how the class processes data. I want to enforce implementation of a setParams() function across all derived classes. However, because the parameters for each derived class are unique in number and type to that class, it doesn't seem like creating a pure virtual function will work due to the argument missmatch. Here is an outline of my hierarchy:
class Base{
public:
// Constructor, destructor, etc...
virtual void setParams() = 0; // This is the function for I wish to enforce implemenation
}
class DerivedA{
private:
int param0;
double param1;
char param2;
public:
// Internals
// I know this won't work
virtual void setParams( int param0, double param1, char param2 );
}
class DerivedB{
private:
double param0;
double param1;
public:
// Internals
// I know this won't work
virtual void setParams( double param0, double param1 );
}
I would like to avoid passing parameters in numerical arrays, if possible, because I would prefer the argumets of the setParams function to be descriptive for each class ( mostly for intellisense style lookup ).
Does anyone know if such a construct exists in the c++ spec, and if so, how can I do this?
Thanks