Steve's right, here is what goes on under the hood.
When C::Foo is called it is passed the implicit 'this' as its first parameter. Then when the function reads or rights member variables, that pointer is dereferenced. So the following are equivalent:
struct C{ int a; void foo( ) { a = 5; std::cout << "C::foo\n"; }};///////////////////////////////////////struct C{ int a;};void foo(C* this){ C->a = 5; std::cout << "C::foo\n";};
Because your code never does anything with member variables, the invalid this is never dereferenced and thus never causes a problem. The following code will probably work too:
struct A{ void say( std::string msg ) { std::cout << msg; }};A* a = NULL;a->say("hello");
I'm pretty sure this behaviour is undefined, so I would try to avoid it.
<edit>I didn't see your last post, don't really understand why that's happening...