The constructors that can take arguments is known as parameterized constructors.
With the parameterized constructors we can initialize objects with different data values.
With the parameterized constructors we can initialize objects with different data values.
class integer
{
private : int m.n;
public: integer (int x, int y) // parameterized constructors
{
{
private : int m.n;
public: integer (int x, int y) // parameterized constructors
{
m=x; n=y;
}
};
integer a(10,20); // implicit call
integer a = integer(10,20); // explicit call
};
integer a(10,20); // implicit call
integer a = integer(10,20); // explicit call
Tags:
Cpp