I have to solve a problem where I need to evaluate a function. Let's called it g(y). This g(y) depends on functions f(y) and h(f(y)). (f and h are known)Have tried to solve this problem using virtual functions, but I get the error message "undefined reference to" do_something_else function. The first evaluation works fine, but the the second one doesn't work. Any help is appreciated.
It is a very weird (.text._ZN6logDer8evaluateESt7complexIdE [logDer::evaluate(std::complex<double>)]+0x126): undefined reference to ` do_something_else(arguments .... )
The function f(y) is actually a quite complicated complex mathematical function and I need to evaluate logarithmic derivative of that function g(y). So its argument is complex<double> not double. (actually every number is complex) I don't know if there is something wrong with the syntax, so I tried to show what is the problem. Even my editor says that there is something wrong in that line. Even if do_someting_else is simply a function that takes a double and returns it. But I am sorry there is a one mistake. It should be
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
class C : public A{
private:
double b; // Parameter
public:
// Constructor and destructor
do_something_else(A* Beta,y){ // Also do_something_else evaluates
return Beta->evaluate(y); // function f(y)
}
double evaluate(double y){ // Evaluate function g(y)
A* Beta = new B(b); //
double f = Beta->evaluate(y); // At first evaluate f(y)
double h = do_something_else(Beta,y); // then evaluate h(f(y))
return h*f;
}
friendclass B;
}:
// Finally I need to evaluate function g(y) in the main
A* Celcius = C(b);
C->evaluate(y)
The question is that should I declare the function do_something_else somehow?