Out put of destructor |
# include<iostream>
# include<conio.h>
using namespace std;
class alpha{
static int count;
public:
alpha(){
count++;
cout<<endl<<"No. of object ctreated"<<count;
}
~alpha(){
cout<<endl<<"No. of object destructed"<<count;
count--;
}
};
int alpha::count=0;
int main(){
cout<<endl<<"Enter main"<<endl;
alpha a1,a2,a3,a4;
{
cout<<endl<<"Enter block one"<<endl;
alpha a5;
}
{
cout<<endl<<"enter block 2"<<endl;
alpha a6;
}
cout <<endl<<"Re enter main"<<endl;
getch();
return (0);
}
No comments:
Post a Comment