News for hackers. Stuff that matters.
Re:Dereferencing NULL Pointer, without a Seg Fault by z92 on Wednesday July 11, 2012 @02:18AM (#4228016)
Tried it. It works.

Technically I look at methods as functions with a hidden first parameter that accepts a pointer to the class object's data. If you don't try to dereference that pointer, then the function should work like static member.

I was wondering if the compiler will add some check code preventing me from calling any method on a NULL pointed obj. But obviously its permitting it.

Of course virtual methods are different. Then you are calling a pointer to a function, the address of which should be stored in your obj data structure.

There are no comments on this comment yet.