📄 静态成员.cpp
字号:
#include <iostream.h>
class A
{
private:
int count;
public:
A():count(0)
{
cout << "Can you see me Now!" << endl;
}
~A()
{
cout << "I'm Go Away!" << endl;
}
void Inc()
{
count++;
}
int Count()
{
return count;
}
};
void TestStatic( )
{
static A a;
a.Inc();
cout << "count's value is : " << a.Count() << endl;
}
void main()
{
cout << "Program Start!" << endl;
TestStatic();
TestStatic();
TestStatic();
cout << "Program End!" << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -