Abstract classes, Interfaces, and Patterns
- slide 32 : 41
Cloning versus use of copy constructors
Cloning with
obj.Clone()
is more powerful than use of copy constructors, because
obj.Clone()
may exploit polymorphism and dynamic binding
A cloneable class Point.
A cloneable class ColorPoint.
Polymorphic Cloning of Points.
Non-polymorphic Cloning of Points - with use of copy constructors.
Output of both polymorphic and non-polymorphic cloning.