Default constructor is Use to initialize The Variable in C++ Programming with source code

#include<iostream.h>
#include<conio.h>
class first
{   //Default constructor is Use to initialize The Variable.
   private:
        int a,b;
   public:
        first()//default constructor.
        {
          a=500;
          b=1000;
        }
        void display()
        {
          cout<<"\nThe Value of A=>"<<a;
          cout<<"\nThe Value of B=>"<<b;
        }
};
void main()
{
   clrscr();
   first f1;//default constructor is Call.
   f1.display();
   getch();
}
Default constructor is Use to initialize The Variable in C++ Programming with source code Default constructor is Use to initialize The Variable in C++ Programming with source code Reviewed by Unknown on 5:58:00 PM Rating: 5

No comments:

Powered by Blogger.