kingBook

导航

c++ 中bool 的默认值

比如在Test.h中定义变量: _isFirst;

//Test.h头文件
#ifndef __TEST_H__
#define __TEST_H__
class Test{
private:
    bool _isFirst;
};
#endif

然后访问它:

#include "Test.h"
#include "cocos2d.h"
Test::Test(){
    if(_isFirst){ CCLOG("%s","default value is true");}//output:default value is true
}  

c++中bool的默认值为true

 

posted on 2015-06-26 15:51  kingBook  阅读(7619)  评论(0编辑  收藏  举报