9

Yes, you are correct. Something I noticed which is worth keeping an eye on is that both modifiers of 'parent' contracts as well as any functions are overwritten by inheritance even when using 'super'. For example, calling test(0) on B passes and returns 10 (not 5 as one may be led to believe), but fails on contract A. pragma solidity ^0.4.15; contract A {...


8

As of Solidity 0.6.0, the keywords virtual and override are available natively in Solidity for function overriding. The purpose of these keywords is to be more explicit when overriding a function. Base functions can be overridden by inheriting contracts to change their behavior if they are marked as virtual. The overriding function must then use the override ...


1

Any interface can be, by definition, overridden by any real function having that same ABI, but it is not permitted to have N interfaces identical for some member (which precendece in override is not easy defined by inheritance graph!) In other word if you want to have one interface for the first function, it is not needed to repeat that function identical ...


1

Reading your code, V = 1, because after you set V=2 you then call super.f() which sets it to 1.


Only top voted, non community-wiki answers of a minimum length are eligible