Answer
There are two new rules to be aware of:
- All interface functions are implicitly
virtual
. If you want to be explicit about it, the compiler throws a warning.
- All functions inheriting from the interface must set the
override
modifier on every function that overrides an interface function, lest the compiler throws an error.
Example
Try to see what happens if you add virtual
or remove override
from this:
interface MyInterface {
function getBlockNumber() external view returns (uint256);
}
contract MyContract is MyInterface {
function getBlockNumber() public view override returns (uint256) {
return block.number;
}
}
Further Documentation
Note that the virtual
and override
modifiers don't apply only to interfaces. I recommend reading more about them in this other thread and the solidity 0.6 breaking changes docs.