Say I have this class
#include <iostream>
using namespace std;
class Test
{
int x;
public:
int GetMax(int a, int b);
};
int Test::GetMax(int a, int b)
{
x = a > b ? a : b;
return x;
}
int main()
{
// Pointer to class
Test *t;
int *k;
*k = t->GetMax(10, 9);
cout<<k<<endl;
// Note a bove code make program crash
}
What does it help to make a class object as a pointer?
and also the code crashes when it runs, why cant i use int *k to hold the value?