class Test
{
public:
void func()
{
static int count = 0;
printf("%d\n", count++);
}
};
Test a, b;
a.func();//0
b.func();//1
成员函数里的静态变量
最新推荐文章于 2023-11-17 21:42:08 发布
class Test
{
public:
void func()
{
static int count = 0;
printf("%d\n", count++);
}
};
Test a, b;
a.func();//0
b.func();//1