What is Dynamic or run time polymorphism?

0 votes
242 views
Shikhar Arora asked 06-Dec-2019 in Technology by Shikhar Arora

What is Dynamic or run time polymorphism

1 Answer

0 votes
Shrikant Mishra answered 19-Dec-2020 by Shrikant Mishra

What is Dynamic or run time polymorphism?

The actual mean of polymorphism word is having many forms. Into OOPs(object-oriented programming) paradigm, polymorphism is often expressed as 'one interface, multiple functions'.

There are two types of polymorphism in OOPs, Like :-
  • Static Polymorphism
  • Dynamic Polymorphism

Static Polymorphism

The technique of linking a function with an object during compile time is called early binding. This is also called static binding. C# provides two techniques to implement static polymorphism. They are −

  • Function overloading
  • Operator overloading

Dynamic Polymorphism

C sharp allows you to create abstract classes that are used to provide partial class implementation of an interface. Where the Implementation is completed when a derived class inherits from it. Because, the AbstractClasses contain abstract methods, which are implemented by the derived class. So, the derived classes have more specialized functionality.

Here are the rules about abstract classes −

  • We cannot create an instance of an abstract class
  • We cannot declare an abstract method outside an abstract class

When a class is declared sealed, it cannot be inherited, abstract classes cannot be declared sealed.