Every Object has characteristics that contextually describe the object. For example, the Object's name, if it implements and interfaces or if it is an extension of another object.
GeographicShape
'. Other objects within the graphics program such as Square
, Circle
and Triangle
are said to extend the original definition of GeographicShape
. Smart Contracts are akin to classes in Object-Oriented Programming (OOP) languages; they can have Inheritance and Interfaces. There are two very well-known examples of interfaces in use within Ethereum:
However, many of the Ethereum: Ethereum Improvement Proposals (EIPs) define interfaces.
Interfaces are similar to abstract contracts, but they are limited to what the contract’s ABI can represent. In other words, you could convert an ABI into an interface, or vice versa, and no information would be lost. According to the Solidity docs they have a few additional restrictions. For example, Doug Crescenzi, 13 June 2018, Accessed 3 November 2022, https://medium.com/upstate-interactive/solidity-how-to-know-when-to-use-abstract-contracts-vs-interfaces-874cab860c56 )) outlines the following restrictions:
Interfaces are expressed using the interface keyword. Here’s an example:
pragma solidity ^0.4.24; interface token { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); } // End Token
[char][✓ char, 2022-03-22]Review subsections