Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » Object Oriented ProgrammingRSS Feeds

Program that provides an example of destructors

Posted By: Charlie Evans     Category: C++ Programming     Views: 3647

Write a program that provides an example of destructors.

Code for Program that provides an example of destructors in C++ Programming

#include<iostream.h>
#include<conio.h>
class dest
{
    int i;
    public:
    dest()
    {
        i=0;
        cout<<"Hello"<<endl;
    }
    void f()
    {
        cout<<"I= "<<++i<<endl;
    }
    ~dest()
    {
        cout<<"hi";
    }
};

main()
{
    clrscr();
    dest d1,d2;
    d1.f();
}
  
Share: 


Didn't find what you were looking for? Find more on Program that provides an example of destructors Or get search suggestion and latest updates.

Charlie Evans
Charlie Evans author of Program that provides an example of destructors is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!