今天在酷壳网上看到的,保存下来收藏之
---------------------------------分割线----------------------------------------------
#include <iostream> #include <string> class A { public: void hello(const std::string& name) { std::cout << "Hello, " << name << std::endl; } }; int main(int argc, char* argv[]) { A* pA = NULL; pA->hello("Tom"); return 0; }
---------------------------------分割线----------------------------------------------
上面这段代码没有问题,可以正常运行。