Which among the following can be used in place of default constructor?

Ẽm Thư

New member
Which among the following can be used in place of default constructor?
A. constructorName(int x, int y=0)
B. constructorName(int x=0, int y=0)
C. constructorName(int x=0, int y)
D. constructorName(int x, int y)
 
Answer: b
Explanation: For a parameterized constructor to be used as a default constructor, it must have all the default arguments. This makes the constructor to have optional arguments which are not mandatory to be passed.
 

Tìm kiếm

Back
Top