Write a C++ program using a concept of Destructor.


SUBMITTED BY: Nrupeshsinh

DATE: June 30, 2016, 2:25 p.m.

FORMAT: Text only

SIZE: 346 Bytes

HITS: 372

  1. # include<iostream.h>
  2. # include<conio.h>
  3. class myclass
  4. {
  5. public:
  6. myclass()
  7. {
  8. int i;
  9. for(i=1; i<=10; i++)
  10. {
  11. cout<<i<<endl;
  12. }
  13. }
  14. ~myclass()
  15. {
  16. cout<<"Destructor";
  17. }
  18. };
  19. void main()
  20. {
  21. clrscr();
  22. myclass obj; //object is created and autometically called.
  23. getch();
  24. }

comments powered by Disqus