So basically I have a superclass of a Geometric Figure that has private fields, say length and width. I have a subclass of a Rectangle that has a length and width in the constructor.
In the subclass, I must include a method to set the length and width of the Rectangle to the length and width of the private fields of the Geometric Figure. How do I do this?
Thanks
EDIT: For example:
public class GeometricFigure{
private double length;
private double width;
}
public class Rectangle extends GeometricFigure{
public Rectangle(int length, int width){}
//set and get methods here to set the private fields to the variables in the parameter
}