我有这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;
}
}
Run Code Online (Sandbox Code Playgroud)
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;
}
}
Run Code Online (Sandbox Code Playgroud)
3
public class CRect extends Rect{
String color;
public CRect(double w, double h ,String c) { …Run Code Online (Sandbox Code Playgroud)