Difference b/w Abstract Class V/s Interface, and Structure V/s Class

Abstract Class V/s Interface

  • An Abstract class can have implementation for some of its methods. But, the interface can't have implementations for any of its methods
  • An Abstract class can have fields but the interface does not have fields
  • An Interface can inherit from another interface, but, can't inherit from another abstract class; but an abstract class can inherit from another abstract class and another interface
  • The Abstract class members can have access modifiers, whereas, the interface member doesn't have access modifiers

Structure V/s Class

  • A Class is a reference type, so it is stored in a Heap. Structure is a value type, so it is stored in a stack
  • A Class has inheritance, but a structure does not have inheritance
  • In a Class, there is a constructor. But in a structure, there may or may not be a constructor
  • By default, a Class has a private access modifier and a structure has a public modifier


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now