Advertisements
Advertisements
Question
Answer the following in brief. Give a program code example wherever applicable.
Can constructors be overloaded?
Short Answer
Advertisements
Solution
- Flexible Object Creation: It allows a class to have multiple constructors with the same name but different sets of parameters (differing in number, data type, or order of arguments).
- Multiple Configurations: It enables you to initialize different objects of the same class in various ways depending on the data available at that moment.
shaalaa.com
Is there an error in this question or solution?
Chapter 4: Constructors - Exercises [Page 115]
