Overloaded constructor: When more than one constructor function is defined in a same class then it is called as overloaded constructor. All constructors are defined with the same name as the class name they belong to. Each of the constructors contains different number of arguments or different data type of arguments. Depending upon the number of arguments and their data type, the compiler executes appropriate constructor.
Example:-
#include<iostream.h>
#include<conio.h>
class integer
{
int m, n;
public:
integer()
{
m = 0;
n = 0;
}// constructor 1
integer(int a, int b) {
m = a;
n = b;
cout<<"value of m="<<a;
cout<<"value of n="<<b;
} // constructor 2
}
void main() {
clrscr();
integer i1;
integer i2(20,40);
getch();
}