title: C++ calling a class function inside another function
body: <p>I am trying to call an outside function (that takes functions as inputs) inside the class by giving class member functions as it's parameters. My code is as follows:</p>
  
  <pre><code>using namespace std;
  // This is my external function
  double integrate (double a, double b, int steps, double (*func)(double)){
      // code for integration using function pointer
  };
  
  Class A
  {
      protected:
          vector&lt;double&gt; to_data, from_data;
          int data_size;
  
      public:
          A (); // constructor
  
          double calculate_parameter(double t){
              // some class member function that makes use of other class members
          };
  
          double get_result(double x){
              double sum = 0;
          for (int i=0;i&lt;data_size;i++){
             // this is basically what causes the error
              sum = sum + integrate(to_data[i],from_data[i],1,calculate_parameter);
          }
   };
  
  }
  </code></pre>
  
  <p>However, it shows me error that the function calculate_parameter cannot be converted. I figured out a way to solve this would be to modify the external function such that it takes a class object as well. Is there a way to do this without instantiating a new class object? Thanks in advance!</p>