c++ - 静态类 C++

标签 c++ class visual-studio-2013 static

 #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/

相关文章:

c++ - format() 中 int fmt 的值

c++ - 将 void* 引用为 float 时数据丢失

c++ - 我安装了 libboost 但无法链接到它

c++ - 输入迭代器跳过空格,任何防止这种跳过的方法

c++ - 派生类如何访问基类的私有(private)数据成员?

c# - Visual Studio 2013 即时窗口和搜索缓慢

c++ - 如何在构造函数中将基类实例化为派生类?

c++ - 在 C++ 类中使用按引用传递和成员初始化列表时会发生什么?

c++ - 有人使用 kinect-v2 的 openNI 获取了深度图像吗?

c++ - 安装 Visual Studio 2013 后的第一个构建错误。 fatal error LNK1561 : entry point must be defined