2 Jul
2011
2 Jul
'11
5:25 p.m.
The inheritance is going the wrong way. An actionFuntion instance might be called with any RegressionTestScenario*. But you can't call a CurveGenRegressionTestScenario method with any old RegressionTestScenario* -- only a RegressionTestScenario* that is also a CurveGenRegressionTestScenario* would be valid. The compiler isn't going to synthesize logic for you to dynamic_cast
(*your_first_param) (which throws unless your_first_param is in fact a CurveGenRegressionTestScenario*). If you want such logic, you'll have to code an adapter and store that.
It has nothing to do with inheritance. The following code won't compile as well:
struct A
{
void f(int i);
};
boost::function