远行的帆

没有谁能阻挡我前行的步伐,风雨兼程,我也将义无反顾。

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

  写了个小程序,通过一个指针调用类的方法,结果,指针为空,调用类的方法却成功了,c++也太严格了,汗颜。

#include<iostream>
 class testClass 
{
   public:
    int init()
{ 
    std::cout<<"start init"<<std::endl;
}

};

int main()
{

testClass* pTestClass = NULL;
pTestClass->init();
return 0;
}

 

posted on 2013-09-27 21:01  远行的帆  阅读(769)  评论(0编辑  收藏  举报