by Dinesh Thakur

 

// Program to define in different way about the overload constructors

#include<iostream.h>
#include<conio.h>
class integer
{
      private:
      int a;
      public:
                         integer()
                {
                          a=0;
                         cout<<endl<<"Constructor Called. : ";
                }
                         integer(int i)
                {
                          a=i;
                         cout<<endl<<"Constructor with argument called. : ";
                }
                        ~integer()
                {
                     cout<<endl<<"Destructor Called.";
                }
                     void get()
                {
                         cout<<endl<<"Enter the value of integer :" <<endl;
                         cin>>a;
                }
                         void show()
                {
                         cout<<endl<<"The value of integer is :"<<"\t"<<a;
                }
 };
              void main()
     {
              clrscr();
              integer x, y(10);
              x.get();
              x.show();
              y.show();
              getch();
     }

Constructor And Destructor With The Overloading Of Constructor





About Us

Dinesh ThakurDinesh Thakur is a Columinist and designer with strong passion and founder of Computer Notes. if you have any ideas or any request Find Dinesh Thakur on
linkedin FaceBook Twitter Google Plus