The below code runs perfectly fine and prints "Executed".
I don't understand how this can be possible if pointer "p" is NULL ??
#include <iostream>
using namespace std;
class Foo
{
public:
Foo(int i = 0){ _i = i;}
void f()
{
cout << "Executed"<<endl;
}
private:
int _i;
};
int main()
{
Foo *p = NULL;
p -> f();
}