public class MainClass {
public static void main(String[] argv) {
DecoratedRectangle r = new DecoratedRectangle();
System.out.println(r);
}
}
class Shape {
public String toString() {
return "shape";
}
}
class Rectangle {
private int x, y, w, h;
public String toString() {
return "x = " + x + ", y = " + y + ", w = " + w + ", h = " + h;
}
}
class DecoratedRectangle extends Rectangle {
private int borderWidth;
public String toString() {
return super.toString() + ", borderWidth = " + borderWidth;
}
}