Possible Duplicate:
What will happen when I call a member function on a NULL object pointer?
Well I think this code and program output explain it self:
#include <iostream>
#include <string>
using namespace std;
class Test
{
public:
void Not_Static(string args)
{
cout << args << endl;
}
};
int main()
{
Test* Not_An_instance = nullptr;
Not_An_instance->Not_Static("Non-static function called with no object?");
cin.ignore();
return 0;
}
program output:
Non-static function called with no object?
why is that possible?