Posts

Showing posts with the label constructor overloading in cpp

Overloading Of Constructor In C++ | Constructor Overloading Explained With Real Life Examples

 Overloading Of Constructor In C++  What is constructor overloading? As you know what is a constructor  and also what is function overloading . So you know constructors are special class methods which is basically a function which runs at the starting of class always. So as you know how to overload a function then the constructor is also a function so you can overload a constructor as same as function overloading. #include   < iostream > using   namespace   std ; class   calculator {      public :      calculator ( int   a ,   int   b )  //constructor with 2 int type parameter      {          cout << " I AM CONSTRUCTOR  " << a + b << endl ;      }      calculator ( int   a ,   int   b ,   int   c )  //c...