What is parameterized constructor?
A constructor that accepts parameters is called as parameterized constructor. In some applications, it may be necessary to initialize the various data members of different objects with different values when they are created. Parameterized constructor is used to achieve this by passing arguments to the constructor function when the objects are created.
Example:
class ABC
{
int m;
public:
ABC(int x)
{
m=x;
}
void put()
{
cout<<m;
}
};
void main()
{
ABC obj(10);
obj.put();
}