V
Venkatesh
Hi All,
I tried the following code and it seems to work. I am really confused
as to
how this is possible. Can someone please throw some light?
#include<iostream>
using namespace std;
class Y
{
public :
void foo()
{
cout << "Hello World"<< endl;
}
};
main ()
{
Y *ptr = NULL;
ptr->foo();
}
Out put is
Hello World
Thanks in advance.
I tried the following code and it seems to work. I am really confused
as to
how this is possible. Can someone please throw some light?
#include<iostream>
using namespace std;
class Y
{
public :
void foo()
{
cout << "Hello World"<< endl;
}
};
main ()
{
Y *ptr = NULL;
ptr->foo();
}
Out put is
Hello World
Thanks in advance.