constructor overloading in c++

#include <iostream>
using namespace std;

class MyClass {
private:
    int x, y;

public:
    // Default constructor
    MyClass() {
        x = 0;
        y = 0;
    }

    // Parameterized constructor with one parameter
    MyClass(int a) {
        x = a;
        y = 0;
    }

    // Parameterized constructor with two parameters
    MyClass(int a, int b) {
        x = a;
        y = b;
    }

    // Display function to show the values of x and y
    void display() {
        cout << "x = " << x << ", y = " << y << endl;
    }
};

int main() {
    // Creating objects using different constructors
    MyClass obj1;          // Default constructor
    MyClass obj2(5);       // Parameterized constructor with one parameter
    MyClass obj3(3, 8);     // Parameterized constructor with two parameters

    // Displaying the values of x and y for each object
    obj1.display();
    obj2.display();
    obj3.display();

    return 0;
}