Difference between Abstract Class and Polymorphism in C#

 

Here are the points of difference between abstract class and polymorphism:
  • Abstract class is a base class. Cannot create instance whether it may be base class or not. But in polymorphism, we can create instance to base class.

  • In abstract class, we use abstract keyword to method but in polymorphism uses virtual keyword to base class method.

  • In abstract class, we can declare abstract method inside abstract method and can define method which class derived abstract class.

  • In polymorphism, declaration and definition are only inside corresponding class.

  • In polymorphism, we can access derived class method through base class, but in abstract class we cannot access derived class method threw base class because cannot create an object to base class.

  • Abstract method declares only inside abstract class, but we can declare virtual method inside a class as well (it should be a base class).
Ebook Download
View all
Learn
View all