#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();。
转载于:https://www.cnblogs.com/prajna/archive/2013/02/24/2924677.html