Skip to main content

Posts

Showing posts with the label Constructor Overloading

C++ Program On Constructor Overloading-Calculate Area Of Rectangle

This is a sample C++ program on Constructor Overloading. Using Constructor Overloading, here we calculate area of rectangles with default values. #include <iostream.h> #include <conio.h> class rectangle {     private:        int length, breadth;     public:        rectangle ( )         {             length = breadth = 0;             cout<<" Constructor With Zero Parameter Called .\n";         }        rectangle (int a)         {             length = breadth = a;             cout<<" Constructor With One Parameter Called. \n";         }        rectangle (int a, int b)         {             le...