Complete the code to declare a contract that inherits from two contracts.
contract MyContract is [1], ContractB {}The contract MyContract inherits from ContractA and ContractB. You must list the parent contracts after is.
Complete the code to call the constructor of the first parent contract.
contract MyContract is ContractA, ContractB {
constructor() [1]() {}
}super instead of the parent contract's name.To call a parent contract's constructor explicitly, write its name followed by parentheses.
Fix the error in the function override declaration for multiple inheritance.
function foo() public view virtual override([1]) returns (string memory) { return "Hello"; }
When overriding a function from multiple parent contracts, list all parent contracts in the override keyword separated by commas.
Fill both blanks to define a contract that inherits and overrides a function from two parents.
contract MyContract is [1], [2] { function foo() public view virtual override(ContractA, ContractB) returns (string memory) { return "Hello from MyContract"; } }
The contract inherits from ContractA and ContractB. The function foo overrides the versions from both parents.
Fill all three blanks to create a mapping with keys from one contract and values from another.
mapping([1] => [2]) public data; function setData([3] key, uint value) public { data[key] = value; }
The mapping uses address as keys and uint as values. The function parameter key is of type address.