1. Modify the bag from the previous exercise so that all of the add methods attempt to make a clone of any item that is added to the bag. These clones are then put in the bag (rather than just putting a reference to the original item into the bag). Because you don’t know whether the type of items in the bag have a public clone method, you’ll need to attempt to clone in a manner that is similar to Figure 5.10.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here