abstract class Shape {
    public String lineColor; 
    public String fillColor;
    public void setLineColor(String col) {         // 一般方法，对颜色进行处理
        lineColor = col;
    }
    public void setFillColor(String col) {          // 一般方法，对颜色进行处理
        fillColor = col;
    }
    abstract void draw();                       // 抽象方法
}
class Rectangle extends Shape {
    float width, height;
    public Rectangle(float width, float height) {
        this.width = width;
        this.height = height;
    }
    public void draw(){                        // 重写抽象方法
        System.out.print("Rectangle：Line Color = " + lineColor+ ", Fill Color = " + fillColor);
        System.out.println(", Width = " + width + ", Height = " + height);
    }
}
class Circle extends Shape {
    double radius;
    public Circle(double radius) {
        this.radius = radius;
    }   
public void draw(){                        // 重写抽象方法
        System.out.print("Circle：Line Color = " + lineColor + ", Fill Color = "+ fillColor);
        System.out.println(", Radius = " + radius);
    }
}
class Example4_12 {
    public static void main(String[] args) {
       Shape rectangle = new Rectangle(20, 10);           //创建一个Rectangle向上造型的对象
       rectangle.setLineColor("blue");                   //调用父类方法
       rectangle.setFillColor("yellow");
       rectangle.draw();                               //调用Rectangle类中的draw方法
       Shape circle = new Circle(5.5);
       circle.setLineColor("red");                       
       circle.setFillColor("green");
       circle.draw();                                  
    }
}
