Solidity Challenge 2: 🚢 Ahoy, developers! Welcome to the Unload Challenge! Calling Unload.cargo() will unveil the cargo. Can you tell which cargo will be unloaded, apples or bananas?
It was a challenge about inheritance. The correct answer is ‘bananas’ because when a function is called that is defined multiple times in different contracts, parent contracts are searched from right to left.
The override(Ship_B, Ship_A) part gives the false impression of a locally determined inheritance ordering, but it does not actually influence it.
::: spoiler spoiler
Seems like the last mentioned contract in the is Ship_A, Ship_B part determines which one super refers to when they have matching function names.
:::
0
Solidity Challenge 2: 🚢 Ahoy, developers! Welcome to the Unload Challenge! Calling Unload.cargo() will unveil the cargo. Can you tell which cargo will be unloaded, apples or bananas? | Spyke
It was a challenge about inheritance. The correct answer is ‘bananas’ because when a function is called that is defined multiple times in different contracts, parent contracts are searched from right to left. The override(Ship_B, Ship_A) part gives the false impression of a locally determined inheritance ordering, but it does not actually influence it.
Nice challenge!
::: spoiler spoiler Seems like the last mentioned contract in the
is Ship_A, Ship_Bpart determines which onesuperrefers to when they have matching function names. :::