stat_fun.cpp
来自「本代码是《C/C++程序员实用大全》的配套代码。网络转载」· C++ 代码 · 共 40 行
CPP
40 行
#include <iostream.h>
class shared
{
static int a;
int b;
public:
void set(int i, int j)
{
a=i;
b=j;
}
static void show();
};
int shared::a; // Define the a global variable
void shared::show()
{
cout << "This is static a: " << a << endl;
}
void main(void)
{
shared x, y;
x.set(1,1);
y.set(2,2);
shared::show();
y.show();
x.show();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?