There are two classes
class cFunction { public: cFunction(double _a, double _b, double _c, double _x); virtual double getY(); protected: virtual double function(); cArguments *args; double x, y; }; class cFunction1 : public cFunction { public: cFunction1(double _a, double _b, double _c, double _x); protected: double function(); };
the constructor for the parent looks like
cFunction::cFunction(double _a, double _b, double _c, double _x) { args = new cArguments(_a,_b,_c); x = _x; y = function(); }
if for a successor, the constructor is done as described below, then the function () method is called parent, despite the fact that it is virtual
cFunction1::cFunction1(double _a, double _b, double _c, double _x) : cFunction(_a, _b, _c, _x) { }
if you do this
cFunction1::cFunction1(double _a, double _b, double _c, double _x) { args = new cArguments(_a,_b,_c); x = _x; y = function(); }
then there is an error
In constructor 'cFunction1::cFunction1(double, double, double, double)': no matching function for call to 'cFunction::cFunction()'
How to do, what would the constructor of the heir use its own function method?