Introduction

The following code defines an abstract class with an abstract property.

abstract class Shape{
      public abstract double Area
        {
            get;
        }
}

Demo

using System;

abstract class Shape
{
    public abstract double Area
    {/* ww w.j av a2 s  .  c om*/
        get;
    }
}
class Circle : Shape
{
    int radius;
    public Circle(int radius)
    {
        this.radius = radius;

    }
    public int Radius
    {
        get
        {
            return radius;
        }
    }
    public override double Area
    {
        get
        {
            return 3.14 * radius * radius;
        }
    }
}
class Program
{
    static void Main(string[] args)
    {

        Circle myCircle = new Circle(10);
        Console.WriteLine("\nRadius of the Cricle is {0} Unit", myCircle.Radius);
        Console.WriteLine("Area of the Circle is {0} sq.Unit", myCircle.Area);
    }
}

Result

We have used inheritance modifiers such as abstract, virtual, and override, with properties.

We can use other inheritance modifiers also, such as new and sealed.

Properties can be associated with all access modifiers (public, private, protected, and internal); static modifiers (static); and unmanaged code modifiers (unsafe, extern).

Related Topic