title: no known conversion 'float (MyClass::*)' to 'float (*)'
body: <p>I am supposed to write a program which has to generate a triangle function, calculate the derivative using forward and backward divided differences and differentiate the triangle function.
  So, I wrote some code and have only one problem:</p>
  
  <blockquote>
    <p>include\MyClass.h|12|note:   no known conversion for argument 1 from 'float (MyClass::<em>)(int, float, float)' to 'float (</em>)(int, float, float)'|</p>
  </blockquote>
  
  <p>My code:</p>
  
  <p>main.cpp</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "MyClass.h"
  using namespace std;
  
  int main()
  {
      MyClass object (3,4,2,0.1);
  
      for (float i=object.x; i&lt;2.5; i+=0.01)
      {
          cout &lt;&lt; object.Triangle(10, 3.14, i) &lt;&lt; " ";
      }
  
      cout &lt;&lt; "////////////////////";
  
      for (float i=object.x; i&lt;2.5; i+=0.01)
      {
          cout &lt;&lt; object.Derivative(&amp;object.Triangle, i, object.con) &lt;&lt; " ";
      }
  }
  </code></pre>
  
  <p>MyClass.h</p>
  
  <pre><code>#ifndef MYCLASS_H
  #define MYCLASS_H
  
  
  class MyClass
  {
      public:
          MyClass();
          MyClass(int k_max, float omega, float x, float con);
          ~MyClass();
          float Triangle (int k_max, float omega, float x);
          float Derivative (float (*w) (int k_max, float omega, float x), float var, float con);
          float DerivativeCntr (float (*w) (int k_max, float omega, float x), float var, float con);
          int k_max;
          float omega, x, result, con;
  };
  
  #endif // MYCLASS_H
  </code></pre>
  
  <p>MyClass.cpp</p>
  
  <pre><code>#include "MyClass.h"
  
  MyClass::MyClass() {}
  MyClass::~MyClass() {}
  
  MyClass(int K_max, float Omega, float X, float Con)
  {
      k_max=K_max;
      omega=Omega;
      x=X;
      con=Con;
  }
  
  ///////////////////////////////////////////////
  
  float Triangle (int k_max, float omega, float x)
      {
          result=0;
  
          for int (i=0; i&lt;=k_max; i++)
          {
              result += ( 8*pow(-1, i)*(sin((2*i+1)*omega*x ) / ( pow(2*i+1, 2) * pow(M_PI, 2) )
          }
          return result;
      }
  
  ///////////////////////////////////////////////
  
  float Derivative (float (*w) (int k_max, float omega, float x), float var, float con)
      {
          float result = (w(10, 3.14, var+con) - w(10, 3.14, var))/var;
          return result;
      }
  
  ///////////////////////////////////////////////
  
  float DerivativeCntr (float (*w) (int k_max, float omega, float x), float var, float con)
      {
          float result=(w(10, 3.14, var)-w(10, 3.14, var-con))/2*var;
          return result;
      }
  </code></pre>
  
  <p>I would really appreciate your help, thanks!</p>
  
  <p>EDIT:
  I've got this program working, but it's recommended to use a class and required to use a pointer to the function. That's my non object-oriented code:
  <a href="https://ideone.com/mtPLAo" rel="nofollow noreferrer">https://ideone.com/mtPLAo</a></p>