I am basically creating a shape, and have two classes, "Shape" and "Point" Now I am declaring a position in point, a simple
And my code for shape so far isCode:public class Point : Shape { //Instance Variables private double y; private double x; // Getters public double X { get { return x; } //set { x = value; } } public double Y { get { return y; } //set { y = value; } } // Methods public override void Move(double dx, double dy) { double a = X + dx; double b = Y + dy; } // Constructor public Point(double x0, double y0) { x0 = X; y0 = Y; Position = this.Position; }
I'm really confused on the two constructors, I am supposed to create a new point object, and assign it to position, but I'm confused on how I would do that. I don't even have a general idea, can someone help me? Did I do the point code wrong somehow?Code:private Shape position; public Shape Position { get { return position; } set { position = value; } } public virtual void Move(double dx, double dy) { X = x + dx; Y = y + dy; } // Constructor public Shape(double x0, double y0) { } public Shape() { }
-Thanks!




Reply With Quote