Const in Copy Constructor | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Const in Copy Constructor

What is the purpose of having const in copy constructor like Test(const Test& obj) What is the purpose of this const and what if i remove this const, will it work properly or not). What other reason of having const except accodently not been modify inside copy constructor function.

15th Oct 2019, 1:42 PM
Amit chavare
Amit chavare - avatar
2 Answers
+ 1
~ swim ~ Yeah i did i got error but i jist wanted to know the reason....bcz someone asked me this question and they is other reasons also to have const and i was not getting thats why posted
15th Oct 2019, 5:29 PM
Amit chavare
Amit chavare - avatar
+ 1
Thanks ~ swim ~
15th Oct 2019, 6:06 PM
Amit chavare
Amit chavare - avatar