.NET Course
  • Welcome developers
  • LINQ
    • Advanced c# overview
      • Implicit typing
      • Generics
      • Attributes
      • Reflection
      • Delegates
      • Anonymous Methods and Lambda Expressions
      • Events
      • Anonymous Types
      • Ref vs Out
      • Task
      • TaskFactory
      • Asynchronous programming with async and await
      • Abstract class VS Interface
      • Inheritance, Composition and Aggregation in C#
    • LINQ Tutorial
      • Loading Related Entities
      • Lambda Expression
      • Standard Query Operators
    • Testing ASP.NET Core
      • Implementing unit tests for ASP.NET Core Web APIs
    • Software development principles
      • Object-Oriented Programming (Principles)
      • N-tier architecture style
      • Command and Query Responsibility Segregation (CQRS) pattern
      • SOLID: The First 5 Principles of Object Oriented Design
  • Helping links
    • SonarQube installation and tutorial for .net core projects
  • C# .NET Interview Questions
    • Ultimate C# Interview questions
      • Part 4
      • Part 3
      • Part 2
      • Part 1
  • Unit test .NET Core xUnit & MOQ
    • Content
      • Snippets
      • Traits
Powered by GitBook
On this page

Was this helpful?

  1. LINQ
  2. Advanced c# overview

Abstract class VS Interface

  • A class can implement any number of interfaces but a subclass can at most use only one abstract class.

  • An abstract class can have non-abstract methods (concrete methods) while in case of interface, all the methods have to be abstract.

  • An abstract class can declare or use any variables while an interface is not allowed to do so.

  • In an abstract class, all data members or functions are private by default while in an interface all are public, we can’t change them manually.

  • In an abstract class, we need to use abstract keywords to declare abstract methods, while in an interface we don’t need to use that.

  • An abstract class can’t be used for multiple inheritances while the interface can be used as multiple inheritances.

  • An abstract class uses a constructor while in an interface we don’t have any type of constructor.

PreviousAsynchronous programming with async and awaitNextInheritance, Composition and Aggregation in C#

Last updated 3 years ago

Was this helpful?