When you use the add function to add an object to a vector, is it a shallow copy or deep copy?
If it’s shallow it means if you change the objects in the vector you would change the original copy of the object?
When you use the add function to add an object to a vector, is
Share
it is shallow copy, well actually it is not copy at all, the list has the reference to the same object. If you want to pass the deep copy, use implement Cloneable iface and method clone() or you can use a copy constructor.