不用静态变量的话可以增加代码的简洁度,采用静态函数代替,由于返回的是引用,所以该函数可以直接赋值,
isStartedUp()=true;其次由于静态变量在函数块内部只初始化一次并存在,所以可以一直使用
/** Checks has the Module been started up. */
static bool& isStartedUp()
{
static bool inst = false;
return inst;
}
不用静态变量的话可以增加代码的简洁度,采用静态函数代替,由于返回的是引用,所以该函数可以直接赋值,
isStartedUp()=true;其次由于静态变量在函数块内部只初始化一次并存在,所以可以一直使用
/** Checks has the Module been started up. */
static bool& isStartedUp()
{
static bool inst = false;
return inst;
}