24.Abstract Class
Last updated
Was this helpful?
Was this helpful?
public abstract class Shape
{
public abstract double GetArea();
}
public class Circle : Shape
{
public double Radius { get; set; }
public override double GetArea()
{
return 3.141 * Radius * Radius;
}
}
public class Triangle : Shape
{
public double Width { get; set; }
public double Height { get; set; }
public override double GetArea()
{
return 0.5 * Width * Height;
}
}