0

Can we overload the constructor?

9th Apr 2022, 5:40 PM
Pavan Sahastrabuddhe
Pavan Sahastrabuddhe - avatar
4 Réponses
+ 3
Yes you can in java and C++, overloading the constructors is done by changing the number of parameters.
9th Apr 2022, 5:59 PM
William Owens
William Owens - avatar
+ 2
You can overload constructors and methods in c++ by changing parameters and return type in c++ Constructor dont have any return type but it is for methods(member function) But in java the return type of methods must be same
10th Apr 2022, 5:41 PM
Anand</left>
Anand</left> - avatar
+ 1
In C++ you can also overload the new operator.
10th Apr 2022, 2:43 AM
Brian
Brian - avatar