#include <iostream>
using namespace std;
class Counter{
public:
static int created, destroyed;
Counter(){
created++;
}
~Counter(){
cout<<"So far "<<++destroyed<<" destroyed"<<endl;
}
};
int Counter::created = 0;
int Counter::destroyed = 0;
int main(){
Counter one, two, three;
cout<<"So far "<<Counter::created<<" created"<<endl;
return 0;
}
Comments
Leave a comment