您的位置:首页 > 其它

static的一个心得,自己学习用

2007-03-01 13:10 330 查看
//仅仅供自己学习记录一下的.

#include <stdio.h>

class ca
{
public:
void print_static(long c)
{
static long countor = 0;
printf("=== %d.countor %d ===/n",c,++countor);
}
};

int _tmain(int argc, _TCHAR* argv[])
{
static long countor = 0;

ca * p = new ca;

if(p)
{
p->print_static(++countor);
p->print_static(++countor);

delete p;
}

p = new ca;
if(p)
{
p->print_static(++countor);
p->print_static(++countor);

delete p;
}

system("PAUSE");

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: