Understanding inheritance, abstract contracts, and interfaces
There are four important pillars of object-oriented programming (OOP), as follows:
- Inheritance
- Encapsulation
- Abstraction
- Polymorphism
All of the preceding concepts play a critical role in influencing modern programming language design and software development. Inheritance enables code reuse and extensibility. Encapsulation refers to information hiding and bundling data within methods to avoid unauthorized direct access to the data. Abstraction is the process of exposing only the necessary information and hiding the details from other objects. Polymorphism allows functional extensibility via the overloading and overriding functions.
Like most modern object-oriented languages, such as Java or C++, Solidity supports OOP concepts through inheritance, abstract contracts, and interfaces. In fact, it supports a superset of these features from both Java and C++. Let’s go over them now:
-
...