0

why do we use Default constructor?

i juat wanna know why do we use default constructora in C++ and what is its work please help me.

17th Nov 2016, 7:53 PM
Yam Zaidi
Yam Zaidi - avatar
2 Answers
+ 1
if we dont wanna pass an argument for a function call where three arguments are specified in the function definition. ex. int sum(int i,int j,int k= 10);
28th Feb 2017, 12:14 AM
Dheshoju Kalyan Kumar
Dheshoju Kalyan Kumar - avatar
0
If you don't define one, the compiler will write one for you, so while it is not required, it is good practice to do so. If there are any default values you need to set, they are set in the constructor.
17th Nov 2016, 8:13 PM
scott johnson
scott johnson - avatar