I trying to pass an array but don't understand why it gives me those errors. The code is also available in ideone.com
#include <iostream>
using namespace std;
class Max
{
   int max = 0;
   public:
      int getMax(int array[], int size)
      {
          for(int num : array)
          {
                if(num > max)
                    max = num;
          }
          return max;
      }
};
int main( )
{
   Max m;
   int arr[5] = { 5, 3, 2, 7, 6 };
   cout << "Max number is: " << m.getMax(arr,5);
   return 0;
}
 
     
     
     
    