Abstract Class
- "Abstract classes are useful when you need a class for the purpose of inheritance and polymorphism"
- The purpose of an abstract class is to provide default functionality to its subclasses
- When a class contains at least one abstract method, then the class must be declared as an abstract class
- It is mandatory to override the abstract method in the derived class
- When a class is declared as an abstract class, then it is not possible to create an instance for that class
- But it can be used as a parameter in a method
using System;
public abstract class Calculation
{
public abstract int sum(int a, int b); // an abstract class has no body ie no implementaiton
public int multiply(int a, int b) // this is non-abstract method
{
return (a * b);
}
}
public class Test : Calculation
{
public static void Main()

Join the conversation! Your thoughts help the community grow.