Visibility and Accessibility Modifiers
Abstract Modifier
The abstract modifier is used in inheritance scenarios. When applied to a class, it forces that class to be inherited, you can't instantiate an abstract class. When applied to a type member, such as a method, it enforces that anything that inherits from the class has to implement the abstract member.
using System; // The message class...
In the above example, we've created a class called 'Message'. The Message class cannot be instantiated using the new keyword because it needs to be inherited:
public class EmailMessage : Message { public override string GetAddress() { return "me@somewhere.com"; } }
The GetAddress method is also marked as abstract, and you'll notice that we haven't actually provided an implemention, we simply end the declaration with the ; semi-colon line terminator.
When we implement an abstract method in your inherited class, you must specify the override modifier as part of the declaration:
public override string GetAddress() { }