Hi,
This is a piece of code I found while going through a web site..
Surprisingly it compiles and gives the expected output(prints the line), even though the pointer is initialized to NULL.
I am using gcc 3.3 on Mac OS X.
Can any one tell me what's happening?
What's the point of having static member functions when you can access functions like this?
#include <iostream.h> class Simple { public : void memfunction() { cout << "Hello I am in memFunction" ; }
};
Simple *objSimple = NULL;
void wrapper() {
/* how we are able to access the member function , when we had not created an object ? then wht's the use of Static meber functions ? */ objSimple->memfunction();
}
int main() { wrapper(); exit(0);
}
Thanks, Yogesh