Why are default values for constructors added in the header file and not the implementation file?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why are default values for constructors added in the header file and not the implementation file??

suppose I have two private member variables and I always want them to be initialized to 1 and 2 respectively through a defaul parameter constructor . doesnt this mean that if the default values are specified in the header file, the user can change them as they please?

27th Apr 2017, 5:36 PM
kwenaldo
kwenaldo - avatar
2 Answers
0
at which language are you refering to?
28th Apr 2017, 11:50 PM
Giannis Tsirovasilis
Giannis Tsirovasilis - avatar
0
c++
29th Apr 2017, 5:39 PM
kwenaldo
kwenaldo - avatar