this is my code:
#include <iostream>
using namespace std;
class Sp
{
private :
int a;
int b;
public:
Sp(int x = 0,int y = 0) : a(x), b(y) { };
int max(int x,int y);
};
int Sp::max(int a,int b) { return (a > b ? a : b); };
int main()
{
int q,q1;
cin >> q >>q1;
Sp *mm = new Sp(q,q1);
cout << mm.max(q,q1);
return 0;
}
Instead of:
mm.max(q,q1);you need to use:
mm->max(q,q1);mm is a pointer and needs to be addressed as such.
Alternately, you could just say:
and avoid pointers all together.