You are on page 1of 5

abstract class

abstract
abstract (C#.Net) MustInherit (VB.Net)
const
event
Indicate that a class is intended only to be a base class of other classes.
Abstract classes have the following features:
extern
An abstract class cannot be instantiated.
override
An abstract class may contain abstract methods and properties.
readonly It is not possible to modify an abstract class with the sealed modifier, which means that the
sealed class cannot be inherited.
static A non-abstract class derived from an abstract class must include actual implementations of
unsafe all inherited abstract methods and properties.
virtual
volatile

C# VB.Net

DEMO
abstract methods
abstract
abstract (C#.Net) MustInherit (VB.Net)
const
event
Abstract methods have the following features:
An abstract method is implicitly a virtual method.
extern
Abstract method declarations are only permitted in abstract classes.
override
Because an abstract method declaration provides no actual implementation, there is no
readonly method body.
sealed The implementation is provided by an overriding method, which is a member of a non-
static abstract class.
unsafe It is an error to use the static or virtual modifiers in an abstract method declaration.
virtual C# VB.Net
volatile

DEMO
abstract properties
abstract
abstract (C#.Net) MustInherit (VB.Net)
const
event
Abstract properties
It is an error to use the abstract modifier on a static property.
extern
An abstract inherited property can be overridden in a derived class by including a property
override
declaration that uses the override modifier.
readonly
sealed
static
unsafe
C# VB.Net
virtual
volatile

DEMO
abstract vs interface
abstract
abstract interface
const
event
Abstract classes can have concrete methods. Interfaces can not have concrete methods.
extern Abstract classes is designed to be a base class. Interface is a contract that defines the signature
override of the functionality.
readonly Abstract classes fall under the inheritance. Interfaces do not fall under inheritance.
sealed
static abstract class interface
unsafe
virtual
volatile

DEMO
const
abstract
const (C#.Net) Const (VB.Net)
const
event
Specify that the value of the field or the local variable cannot be modified.
extern
override
readonly C# VB.Net
sealed
static
unsafe
virtual
volatile DEMO

It is a compile-
time error to
change the value
of a constant.

You might also like