by pzling » Fri Jan 20, 2012 8:31 am
My attempt was just to copy the ParametersConstant class and add another input for time3 in the Integral function so that there are two time domains (and called it ParametersPWConstant).
My problem is that the compiler keeps thinking ParametersPWConstant is an abstract class. As I understand, an abstract class becomes concrete once all its undefined functions are defined. Having done so, I still don't understand why the class is still coming up as abstract.
Thanks for your help.
Header
======
class ParametersPWConstant : public ParametersInner
{
public:
ParametersPWConstant(double constant);
virtual ParametersInner* clone() const;
virtual double Integral(
double time1,
double time2,
double time3) const;
virtual double IntegralSquare(
double time1,
double time2) const;
private:
double Constant;
double ConstantDoubled;
double ConstantSquare;
};
Source
======
ParametersPWConstant::ParametersPWConstant(double constant)
{
Constant = constant;
ConstantDoubled = 2*constant;
ConstantSquare = constant*constant;
}
ParametersInner* ParametersPWConstant::clone() const
{
return new ParametersPWConstant(*this);
}
double ParametersPWConstant::Integral(double time1, double time2, double time3) const
{
return (time2 - time1)*Constant + (time3 - time1)*ConstantDoubled;
}
double ParametersPWConstant::IntegralSquare(double time1, double time2) const
{
return (time2 - time1)*ConstantSquare;
}