#include"stdafx.h"
#include"iostream"
using namespace std;
static class base{
public:
int i = 3;
};
int main(){
base ob;
system("pause");
return 0;
}
请告诉我,类声明中的“static”是什么意思?
最佳答案
"Please tell me, what do "static" in class declaration? Thank."
它实际上什么都不做,但会被编译器忽略(看起来只有 VS 2013)。有关于此的警告:
source_file.cpp(9) : warning C4091: 'static ' :
ignored on left of 'base' when no variable is declared
查看实时编译器示例 here please .
关于c++ - 静态类 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29175372/