Polymorphism- SOLIDITY

Polymorphism- SOLIDITY

Polymorphism is an ability to process data in more than one form as like others OOP Programing. There are two types of polymorphism in SOLIDITY:

  1. Function Polymorphism/Method Overloading
  2. Contract Polymorphism/Method Overriding

Function Polymorphism:

Function polymorphism refers to declaring multiple functions within the same contract or inheriting contracts having the same name but different parameter/signature or in the number of parameters. This is also known as Method Overloading.

No alt text provided for this image
Contract Polymorphism

Contract polymorphism means using multiple contract instances interchangeably when they are related to each other by using inheritance. This helps in calling the child contract functions using the instance of the parent contract, Also known as Method Overriding.

No alt text provided for this image

Summary

In this article I was focused primarily on the different types of polymorphism understanding with Function Polymorphism/Method Overloading & Contract Polymorphism/Method Overriding with object-oriented concepts.


Do you have any writing? Why to learn solidity and where to use it? If have please share the link

Like
Reply

To view or add a comment, sign in

More articles by Md. Shohag Mia

Explore content categories