0

I have a template function that takes a function pointer from a template class. However, I am getting an undefined reference. Here is my header file.

template<class T>
bool Function(double(T::*func)(), 
              double(T::*funcderiv)());
              
class Class
{
public:
    Class();    
    ~Class() {};
    
    double Func1() { /* does something */ }
    double Func2() { /* does something */ }
};

Here is my cpp file where I get my compiler undefined reference error.

template<class T>
bool Function(double(T::*func)(), 
              double(T::*funcderiv)())
{
    /* does something */
}

Class::Class()
{
    double (Class::*F1)() = &Class::Func1;
    double (Class::*F2)() = &Class::Func2;
        
    Function<Class>( F1, F2 ); /* Undefined reference to this function */
}

Thankful for any help.

DrJMV
  • 11
  • 2

0 Answers0