InterviewSolution
Saved Bookmarks
| 1. |
If a member function have to be made both zero argument and parameterized constructor, which among the following can be the best option?(a) Two normal and one default argument(b) At least one default argument(c) Exactly one default argument(d) Make all the arguments defaultThis question was posed to me at a job interview.Question is from Default Arguments topic in division Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming |
|
Answer» RIGHT answer is (d) Make all the arguments default Explanation: All the arguments MUST be made default. This will make sure that none of the arguments are mandatory to be passed. Which in turn MEANS that the function can work WITHOUT any ARGUMENT and can be passed with arguments too. |
|