chk this piece of code
#include<iostream.h>
using namespace std;
class hi
{
public:
void print()
{
cout<<"hi";
}
}obj;
int main()
{
hi *h;
h->print();
}
output---> hi
--------------------------------------------------------
#include<iostream.h>
using namespace std;
class hi
{
public:
void print()
{
cout<<"hi";
}
}obj;
int main()
{
obj.print();
}
output---> hi
--------------------------------------------------------------------------
My Question is what actually makes the first one [( ie) use of pointers in classes] advantageous rather the second one ??
atleast explain me when this case is more advantageous rather than the second one inspite of same output
My question may look lame but i need some help ..
please ..
thanks