#include "stdio.h"
class CSta
{
public:
CSta()
{ printf("CSta is constructed\n");
m_sta=0;
}
void friend TestStatic();
private:
int m_sta;
};
void TestStatic()
{
static CSta a;
printf("%d\n",++a.m_sta);
}
int main(int argc, char* argv[])
{
TestStatic();
TestStatic();
return 0;
}
c++静态对象
最新推荐文章于 2022-04-12 12:44:36 发布