Hello, im trying to understand copy constructor but I can not get a point. Can anyone give me a simple example why and when should I use copy constructor?
The second thing is the keyword explicit if anyone can explain me what does it mean?
I already know that explicit keyword disable implicit conversion and that if constructor is explicit
I can not initialize like this: Classname obj=10;
But i do not understand if it disable implicit conversion than i should got an error if i write Classname obj=10.5;
and parameter of explicit constructor is int a but i checked i can do that and works perfectly fine, why than is explicit keyword?
But i do not understand if it disable implicit conversion than i should got an error if i write
Classname obj=10.5;
and parameter of explicit constructor is int a but i checked i can do that and works perfectly fine, why than is explicit keyword?