public abstract class Solid
{
private String name;
//constructor
public Solid(String solidName)
{ name = solidName; }
public String getName()
{ return name; }
public abstract double volume();
}
public class Sphere : Solid
{
private double radius;
//constructor
public Sphere(String sphereName, double sphereRadius) : base(sphereName)
{
radius = sphereRadius;
}
public override double volume()
{ return (4.0/3.0) * Math.PI * radius * radius * radius; }
}
public class RectangularPrism : Solid
{
private double length;
private double width;
private double height;
//constructor
public RectangularPrism(String prismName, double l, double w, double h) : base(prismName)
{
length = l;
width = w;
height = h;
}
public override double volume()
{ return length * width * height; }
}
Which is false?
(A) If a program has several objects declared as type Solid, the decision about which volume method to call will be resolved at run time.
(B) If the Solid class were modified to provide a default implementation for the volume method, it would no longer need to be an abstract class.
(C) If the Sphere and RectangularPrism classes failed to provide an implementation for the volume method, they would need to be declared as abstract
classes.
(D) The fact that there is no reasonable default implementation for the volume method in the Solid class suggests that it should be an abstract method.
(E) Since Solid is abstract and its subclasses are nonabstract, polymorphism no longer applies when these classes are used in a program.