• Business
  • Finance
  • Banking
  • Education
  • General
  • Law
  • Science
  • IT
  • English

Key Differences

Know the Differences & Comparisons

Difference Between Abstract class and Interface in C#

abstract class vs interfaceAbstract Class

An abstract class is one that is intended only to be a base class of other classes. The ‘abstract’ modifier is used to make a class abstract. An abstract modifier indicates that there is some missing implementation that needs to be implemented in the class derived from it. The abstract class can have abstract and non-abstract members. An abstract class should have at least one abstract method, otherwise, there is no use of declaring that class as ‘abstract.’

Example of Abstract Class in C#:
abstract classAs shown in the above example, the abstract method ‘Area’ inside the MyCircle class is overridden in the derived class MyArea.

Interface

An interface contains only the declaration of members including methods, properties, events or indexers. It doesn’t contain the implementation of these members. A class or struct implements the interface, must provide the definition of methods declared in the interface. That means an interface provides a standard structure that the derived class needs to follow.

Example of an Interface in C#:
interface programAs shown in the above example the interface MyData has two method declaration getdata() and showdata(). The class NameData who is implementing this interface should give the definition of methods declared in the MyData interface.

Difference Between Abstract class and Interface

  1. An abstract class can have abstract as well as non-abstract members. But, in an interface, all the members are implicitly abstract and must be overridden in the derived class.
  2. A class may inherit several interfaces but only one abstract class.
  3. An abstract class can contain methods with or with a definition. But, an interface can only contain method signature.
  4. An abstract class can fully, partially or not implemented at all, but an interface should be fully implemented, i.e., all the members must be defined in the deriving class.
  5. An interface cannot contain access modifiers, but an abstract class can have it for functions, properties or events.

You Might Also Like:

Difference Between Interface and Class ref vs out parameterDifference Between ref and out parameter in c# method overloading vs overridingDifference Between Method Overloading and Overriding depreciationDifference Between SLM and WDV research method vs methodologyDifference Between Research Method and Research Methodology census vs sampleDifference Between Census and Sampling

Comments

  1. Krunal says

    December 14, 2017 at 5:27 pm

    Very helpful article to understand the difference between abstract class and interface in c#.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Top 5 Differences

  • Difference Between PERT and CPM
  • Difference Between Micro and Macro Economics
  • Difference Between Developed Countries and Developing Countries
  • Difference Between Management and Administration
  • Difference Between Qualitative and Quantitative Research



New Additions

  • Difference Between Deforestation, Reforestation and Afforestation
  • Difference Between Race and Ethnicity
  • Difference Between Customer Service and Customer Experience
  • Difference Between Human Capital and Human Development
  • Difference Between Systems Approach and Contingency Approach
  • Difference Between Industrial Relations and Employee Relations
  • Difference Between Introduction and Executive Summary
  • Difference Between Programmed and Non-programmed Decisions
  • Difference Between Depreciation and Devaluation of Currency
  • Difference Between Consumer Market and Business Market

Categories

  • Banking
  • Business
  • Education
  • English
  • Finance
  • General
  • IT
  • Law
  • Science
fb-follow youtube follow

Copyright © 2025 · Key Differences · Contact Us · About Us · Privacy