point/cloneable-vs-copy-constructor/Point.cs - A cloneable class ColorPoint. | Lecture 8 - slide 32 : 41 Program 2 |
public class ColorPoint: Point{ protected Color color; public ColorPoint(double x, double y, Color c): base(x,y){ this.color = c; } // Copy constructor public ColorPoint(ColorPoint cp): base(cp.x,cp.y){ this.color = cp.color; } // Clone method is inherited public override string ToString(){ return "ColorPoint: " + "(" + x + "," + y + ")" + ":" + color; } }