What is Parameterized Constructors?

The constructors that can take arguments is known as parameterized constructors.
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
        {
                  m=x; n=y; 
         }
};
integer a(10,20); // implicit call
integer a = integer(10,20); // explicit call

Post a Comment

Previous Post Next Post