Step 3: Solidity Heredity Simply Explained

in #solidity5 years ago (edited)

10.png
Now we have created a simple Smart Contract with a few get and set functions. Now we can extend our simple contract by inheritance. This will give us a general extension of functionality from one contract to the other. With Solidity Smart Contract Heredity, we don’t have to define any additional functions in our own contract, we can simply access functions from other Smart Contracts.

Solidity Smart Contract Heredity Simply Explained

We now want to inherit “MyFirstContract” from our first contract. This will make it the so-called upper class. All classes or contracts inherited from it will automatically become its subclass. The subclasses inherit all methods, properties and fields from the superclass without having to create them again.

This means that we do not have to define any additional functions in our own contract, but can simply access functions of the superclasses.

How does it all work now?

This article will answer all your questions: Solidity heredity simply explained

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.029
BTC 56832.31
ETH 2344.40
USDT 1.00
SBD 2.43