public class Shape
{
// Private fields
private string name;
private double area;// Constructor
public Shape(string name)
{
this.name = name;
}
// Public method
public double CalculateArea()
{
return area;
}
// Property
public string Name
{
get { return name; }
set { name = value; }
}
}// Define the derived class
public class Circle : Shape
{
// Private field
private double radius;// Constructor
public Circle(double radius) : base("Circle")
{
this.radius = radius;
}
// Override the base method
public override double CalculateArea()
{
area = Math.PI * Math.Pow(radius, 2);
return area;