What is an Abstract Class in C#?
- An Abstract class is a class which is denoted by abstract keyword and can be used only as a Base class. An Abstract class should always be inherited. An instance of the class itself cannot be created. If we do not want any program to create an object of a class, then such classes can be made abstract.
- Any method in the abstract class does not have implementations in the same class. But they must be implemented in the child class.
EX : abstract class AB1{
Public void Add();
}
Class childClass : AB1
{
childClass cs = new childClass ();
int Sum = cs.Add();
}
No comments