Example Abstract Class
Example Abstract Class
Example Abstract Class
Abstract modifier is used when you want the class to be a base class for other classes.
Key points concerning abstract classes:
You may use the abstract modifier in methods and properties to serve the same purpose
of not having implementations of it.
Key points concerning Abstract methods:
Abstract properties are similar to abstract methods except for declaration and
invocation syntax. Key points concerning abstract properties:
An abstract class has to provide implementations for all of its interface members.
Sample:
// Abstract classes
using System;
// Abstract method
public abstract void DoOvertime();
// Abstract property
public abstract int GetHours
{
get;
}
// Abstract property
public abstract int GetWage
{
get;
}
}
dC.DoOvertime();
Console.WriteLine("Hours worked = {0},
Wage earned = {1}", dC.GetHours, dC.GetWage);