Trivial use of Inheritance
class Shape {
void setColor(Color color) {this.color = color ; }
Color color ;
int x, y ; // position of center, say
}
class Circle extends Shape {
void drawCircle() {. . .}
double radius ;
}
class Rectangle extends Shape {
void drawRectangle() {. . .}
double height, width ;
}
Subclasses automatically inherit color, x, y fields of Shape, and setColor() method.