Skip to main content

Posts

Showing posts from November, 2021

Abstract Class vs Interface in C#

  Difference between Abstract Class and Interface in C#   An  abstract class   is a way to achieve the abstraction in C#. An Abstract class is never intended to be instantiated directly. This class must contain at least one abstract method, which is marked by the keyword or modifier  abstract  in the class definition. The Abstract classes are typically used to define a base class in the class hierarchy. Example: // C# program to illustrate the // concept of abstract class using System; // abstract class 'G' public abstract class G {         // abstract method 'gfg1()'     public abstract void gfg1(); }     // class 'G' inherit // in child class 'G1' public class G1 : G {         // abstract method 'gfg1()'     // declare here with     // 'override...