-
I cannot understand the purpose of using overriding.We r using inheriatnce by doing " ExtraStorage is SimpleStorage" and take all of its functions to use them,which is benefical. What does it bring us when we write the whole "store function" again and adding +5 at the end of it ? Why didnt we just write another function with another name at the first place ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The +5 was just an example. Why not write another function? Cuz of gas, in this case. As for why the need to override the function, it's extremely simple. You wanna use a function from a parent contract but you don't wanna pay a dollar gas more, nor do you want to use that same function, but want a few changes. |
Beta Was this translation helpful? Give feedback.
The +5 was just an example. Why not write another function? Cuz of gas, in this case. As for why the need to override the function, it's extremely simple. You wanna use a function from a parent contract but you don't wanna pay a dollar gas more, nor do you want to use that same function, but want a few changes.