You are on page 1of 1

EXP5_1 #include<iostream.h> #include<conio.

h> class test { static int count; public: static void destroy() { cout<<"\n\nDestructor msg:Object number "<<count<<" destroyed..."; count--; } static void create() { count++; cout<<"\n\nConstructor msg object number "<<count<<" created..."; } test() { test::create(); } ~test() { test::destroy(); } }; int test :: count; void main() { clrscr(); cout<<"Inside the main block...."; cout<<"\n\nCreating first object t1..."; test T1; { //block 1 cout<<"\n\nInside block 1.."; cout<<"\n\nCreating two more objects T2 and T3..."; test T2,T3; cout<<"\n\nLeaving block 1..."; } cout<<"\n\nBlock inside the main block"; getch(); }

Page 1

Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)