One of the breaking changes of solidity 0.5 was making explicit function visibility mandatory, hence all interface functions must be defined as external
today.
In solidity 0.6, there seems to be two new function modifiers introduced: virtual
and override
.
How do they overlap with the previous rules for interface functions?
Best Answer
Answer
There are two new rules to be aware of:
virtual
. If you want to be explicit about it, the compiler throws a warning.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 removeoverride
from this:Further Documentation
Note that the
virtual
andoverride
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.