Why constructors have no return type? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Why constructors have no return type?

Is there any OOP principle for this?

19th Apr 2019, 4:09 PM
Paolo De Nictolis
Paolo De Nictolis - avatar
1 Answer
+ 7
Simply spoken: Because they return the object they construct.
19th Apr 2019, 5:10 PM
HonFu
HonFu - avatar