Which among the following is possible way to overload constructor?

Lò Ngọc

New member
Which among the following is possible way to overload constructor?
A. Define default constructor, 1 parameter constructor and 2 parameter constructor
B. Define default constructor, zero argument constructor and 1 parameter constructor
C. Define default constructor, and 2 other parameterized constructors with same signature
D. Define 2 default constructors
 
Answer: a
Explanation: All the constructors defined in a class must have a different signature in order to be overloaded. Here one default and other parameterized constructors are used, wherein one is of only one parameter and other accepts two. Hence overloading is possible.
 

Tìm kiếm

Back
Top