For example I have abstract class Shape
, that gets the coordinates of the shape:
public abstract class Shape{
private int x;
private int y;
public Shape(int x, int y){
this.x=x;
this.y=y
}
public abstract void onDraw();
}
Now I have the class Rect
the extends from Shape
:
public class Rect extends Shape{
private int height;
private int width;
public Rect(int height, int width){
this.height=height;
this.width=width;
}
@Override
public void onDraw(){
//this method should get the width and height and the coordinates x and y, and will print the shape rect
}
}
Now my question is: how can I get the coordinates x and y of the abstract class Shape
from within Rect
?