ABSTRACT CLASS IN C#
The word abstract means a concept or an idea not associated with any specific
instance. In programming we apply the same meaning of abstraction by making
classes not associated with any specific instance.
The abstraction is done when we need to only inherit from a certain class, but not
need to instantiate objects of that class.
In C#, abstraction is achieved using Abstract classes and interfaces.
Abstract Class:
C# Abstract classes are used to declare common characteristics of
subclasses.
A class which contains the abstract keyword in its declaration is
known as abstract class.
It can only be used as a BASE class for other classes that extend
the abstract class.
Abstract classes may or may not contain abstract methods, i.e.,
methods without body ( public void get(); )
Like any other class, an abstract class can contain fields that
describe the characteristics and methods that describe the actions
that a class can perform.
But, if a class has at least one abstract method, then the class
must be declared abstract.
If a class is declared abstract, it cannot be instantiated.
To use an abstract class, you have to inherit it from another class,
provide implementations to the abstract methods in it.
If you inherit an abstract class, you have to provide
implementations to all the abstract methods in it.
An abstract class can implement code with non-Abstract methods.
An Abstract class can have modifiers for methods, properties etc.
An Abstract class can have constants and fields.
An abstract class can implement a property.
An abstract class can have constructors or destructors.
PERSON
STUDENT TEACHER