Abstract

Contracts are identified as abstract contracts when at least one of their functions lacks an implementation.(※ implementation means { … } in function)

Abstract contracts are similar to Interfaces but an interface is more limited in what it can declare.

Note that this contract needs to be defined as abstract, because the function utterance() is declared, but no implementation was provided (no implementation body { } was given).

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.9.0;

abstract contract Feline {
    function utterance() public pure virtual returns (bytes32);
}

contract Cat is Feline {
    function utterance() public pure override returns (bytes32) { return "miaow"; }
}

Interfaces

Interfaces are similar to abstract contracts, but they cannot have any functions implemented. There are further restrictions