#include<iostream>
using namespace std;
class Test
{
public:
void Func()
{
static int obj_num = 0;
cout << " 객체의 현재 개수 : " << ++obj_num << endl;
}
};
int main()
{
Test t1, t2, t3;
t1.Func();
t2.Func();
t3.Func();
return 0;
}
//class 의 객체를 만들면서 객체의 개수가 몇개인지 체크를 하는것!
// account의 번호부여하는것.( = account_number)에 활용! = Static!!★ static으로 하는 시험!★
728x90
반응형
'# PRIVATE' 카테고리의 다른 글
2010년 09월 06일 월요일 (0) | 2010.09.06 |
---|---|
내꺼 탬플릿 (0) | 2010.09.06 |
4 static (0) | 2010.09.06 |
JAVA (0) | 2010.09.02 |
illusion-pink - 바보사랑 (0) | 2010.08.16 |