Abstract classes, Interfaces, and Patterns
- slide 30 : 37
Cloning
Cloning
creates a copy of an existing object
Copying and comparing objects via references
Object cloning
Shallow cloning
:
Instance variables of value type: Copied bit-by-bit
Instance variables of reference types:
The reference is copied
The object pointed at by the reference is
not
copied
Deep cloning
:
Like shallow cloning
But objects referred by references are copied recursively