Signup/Sign In

C++ Constructor Overloading Program

Hello Everyone!

In this tutorial, we will learn how to demonstrate the concept of Constructor Overloading, in the C++ programming language.

To understand the concept of Constructor Overloading in CPP, we will recommend you to visit here:, where we have explained it from scratch.


#include <iostream>
#include <vector>
using namespace std;

//defining the class shape to overload the method area() on the basis of number of parameters.
class Area

    //declaring member variables
    int length, breadth;

    // Constructor without argument
    Area() : length(5), breadth(2)

    // Defining a Constructor with two arguments: length and breadth
    Area(int l, int b) : length(l), breadth(b)

    void GetLength()
        cout << "\nEnter the Length and Breadth of the Rectangle : \n";
        cin >> length >> breadth;

    int AreaCalculation()
        return (length * breadth);

    void DisplayArea(int a)
        cout << "Area of the Rectangle is = " << a << endl;

//Defining the main method to access the members of the class
int main()

    cout << "\n\nWelcome to Studytonight :-)\n\n\n";
    cout << " =====  Program to demonstrate Constructor Overloading in a Class, in CPP  ===== \n\n";

    Area a1; //Default constructor is called

    Area a2(5, 2); //Parameterised constructor is called

    int area1, area2;


    cout << "\n\nCalculating Area using a Default Constructor:" << endl;

    area1 = a1.AreaCalculation();

    cout << "\n\nCalculating Area using a Parameterised Constructor:" << endl;

    area2 = a2.AreaCalculation();

    cout << "\n\nExiting the main() method\n\n\n";

    return 0;


C++ constructor overloading

We hope that this post helped you develop better understanding of the concept of Constructor Overloading in C++. For any query, feel free to reach out to us via the comments section down below.

Keep Learning : )

About the author:
Nikita Pandey is a talented author and expert in programming languages such as C, C++, and Java. Her writing is informative, engaging, and offers practical insights and tips for programmers at all levels.