Objectives
By the end of this lesson you should be able to:- Use the virtual, override, and abstract keywords to create and use an abstract contract
Abstract Contracts
Continue with yourInheritance.sol file. Add ContractD as an abstract contract. Add a virtual function called whoAreYou function, but do not add any implementation for that function.
Reveal code
Reveal code
Inheriting from an Abstract Function
UpdateContractA to inherit from ContractD.
You’ll get a slightly confusing error that ContractA needs to be marked as abstract. Doing so is not the correct fix.
Note: Missing implementation:
Only abstract contracts can declare functions that are not implemented. To fix this, provide an override implementation for whoAreYou in ContractA:
Reveal code
Reveal code