Abstract and interface contracts
Solidity supports both interface and abstract contracts. This can help create base or layout contracts in solidity. In this recipe, you will learn to create the interface and abstract contracts.
Getting ready
You need to have a working Ethereum installation for deploying and testing the smart contract. You can also use the Remix IDE to write and test the solidity code.
It is required to have a basic knowledge of solidity to understand this recipe. Refer to Chapter 2, Smart Contract Development, for more information.
How to do it...
Interface and abstract contracts are mostly very similar, but they cannot have any functions implemented along with other differences. Let's look into each one in detail.
Abstract contracts
- Create abstract contracts just like regular contracts, but they have at least one function without an implementation:
pragma solidity ^0.4.24; contract AbstractContrct { // Function without declaration function f() public returns (uint); ...