What is a copy constructor?
Can someone share a small example that can be helpful to understand along with defensive copying p
This is where you create a new object, by passing an old object, copying its values.
Color copiedColor = new Color(oldColor);
instead of :
Color copiedColor = new Color(oldColor.getRed(), oldColor.getGreen(), oldColor.getBlue());