SOURCE CODE
#include “iostream.h”
#include “conio.h”
class test
{
int code;
static int count;
public:
void setcode(void)
{
code=++count;
}
void showcode(void)
{
cout << "Object Number " <<>
} static void showcount(void)
{ cout << "count " <<>
}
};
int test::count; int main()
{ clrscr();
test t1,t2;
t1.setcode();
t2.setcode();
test::showcount();
test t3;
t3.setcode();
test::showcount();
t1.showcode();
t2.showcode();
t3.showcode();
getch();
return 0;
}
OUTPUT
count 2
count 3
Object Number 1
Object Number 2
Object Number 3