December 2018
Intermediate to advanced
222 pages
6h 6m
English
Many of the most widely used programming languages (such as C++, Java, Go, and Python, and so on) support object-oriented programming (OOP) and support inheritance, encapsulation, abstraction, and polymorphism. Inheritance enables code reuse and extensibility. Solidity supports multiple inheritance in the form of copying code, which includes polymorphism. Even if a contract inherits from multiple other contracts, only a single contract is created on the blockchain.
In solidity, inheritance is pretty similar to classic oriented-object programming languages. Here are a number of examples, as follows:
pragma solidity ^0.4.24;contract Animal { constructor() public { } function name() public returns (string) ...Read now
Unlock full access