0
How to understand copy constructor better?
I get how copy constructor works but i don't know why it works. I am just curious why it is necessary to initialize the constructor variables to the local variables? Like: public Fraction (Fraction other){ this.num = other.num; this.denom = other.denom; } Why do I have to do this?
1 Antwort
0
You can do this if you want to create a real copy.
I hope my code helps you a little bit:
https://code.sololearn.com/c5xaS2p56ORh/?ref=app