Pointer to Class prb

From: Venkatesh (hvenkatesh_at_yahoo.com)
Date: 04/30/04


Date: 30 Apr 2004 03:57:13 -0700

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();
}

Thanks in advance.

Venky