![]() |
#2
stop12042014-10-24 10:06
|
#include<iostream.h>
#include<stdlib.h>
class counter
{
static int count;
int objnumber;
public:
counter()
{
count++;
objnumber=count;
}
void show()
{
cout<<"obj"<<objnumber<<" ";
cout<<"cout="<<count<<"\n";
}
};
int counter::count=0;
main()
{
counter obj1;
obj1.show();
cout<<"------------------";
counter obj2;
obj1.show();
obj2.show();
cout<<"----------------------";
counter obj3;
obj1.show();
obj2.show();
obj3.show();
return 1;
}