What is constructor overloading? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is constructor overloading?

write?

4th Apr 2017, 5:58 AM
amit
5 Answers
+ 6
It is nearly the same thing as function overloading. You create 2 or more constructor of the same name, and make them take in different amount/types of arguments.
4th Apr 2017, 6:15 AM
Wen Qin
Wen Qin - avatar
+ 5
class Program{ Program(){ } Program(int number){ } Program(double decimal){ } Program(String str){ } }
4th Apr 2017, 6:07 AM
Heng Jun Xi
Heng Jun Xi - avatar
+ 1
ok
4th Apr 2017, 6:16 AM
amit
0
Constructor overloading is like creating more than one constructor for same class
4th Apr 2017, 7:18 AM
Rahul Patel
Rahul Patel - avatar
0
ok
4th Apr 2017, 7:19 AM
amit