null pointer call in c++
#include <iostream> class Foo { public: static void bar() { std::cout << "NULL->bar()" << std::endl; } }; int main(void) { Foo * foo = NULL; foo->bar(); //<=> Foo::bar(); return 0; }
空指針可以引用類的static函數,等價于classname::static_fun();。