Is it possible to overload a constructor?
- When an object is created or defined, a constructor method is created. It is used to initializations of the different declared member variables of its object. Overloading a constructor means make it behave differently.
-
Example : The function below has the same name but overloaded to return double and integer values.
double func( double a );
int func( int a, int b );
Is it possible to overload a constructor?
Yes it is possible. A constructor can be overloaded to pass different arguments to the object.