class Shape
{
public:
virtual double getArea() =0;
};
class Rectangle
{
public:
virtual double getArea(){//具体实现请自己实现}
};
class Circle
{
public:
virtual double getArea(){//具体实现请自己实现}
};
public abstract class shape{
public abstract double getarea();
}
class circle extends shape{
final double PI=3.14;
private double radius;
public double getRadius(){
return this.radius;
}
public setRadius(dobule r){
this.radius = r;
}
public double getarea(){
return PI*radius*radius;
}
}
class rectangle extends shape{
private double length ;
private double width;
public double getLength (){
return this.length;
}
public setLength(double len){
this.length = len;
}
public double getWidth (){
return this.width;
}
public setWidth(double w){
this.width = w;
}
public double getarea(){
return length*width;
}
}