why java polymorphism not work in my example
I have these 4 java clases: 1 public class Rect { double width; double height; String color; public Rect( ) { width=0; height=0; color="transparent"; } public Rect( double w,double h) { width=w; height=h; color="transparent"; } double area() { return width*height; } } 2 public class PRect extends Rect{ double depth; public PRect(double w, double h ,double d) { width=w; height=h; depth=d; } double area() { return width*height*depth; } } 3 public class CRect extends Rect{ String color; public CRect(double w, double h ,String c) { width=w; height=h; color=c; } double area() { return width*height;