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.19
TRX 0.24
JST 0.037
BTC 95716.86
ETH 3329.80
USDT 1.00
SBD 3.02