Lesson 9 : Deriving vs importing #1119
-
Hi everyone, My doubt is
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Let's say we have three contracts: Grandfather, Father, and Child contract Here, the Father contract will inherit every characteristic of the Grandfather contract. So, Father has Grandfather; Child has Father and Grandfather. Now, if you were to import Father, you will only get the properties inside the Father contract and not the inherited properties. Hope this answers your query! |
Beta Was this translation helpful? Give feedback.
-
Deriving you mean You should more search about |
Beta Was this translation helpful? Give feedback.
-
Thanks ali @ali-thegilfoyle |
Beta Was this translation helpful? Give feedback.
@GaneshDonikena
import
will simply access all public state variables and functions of the contract.Deriving you mean
inheretance
. By inheriting a contract another contract can use all of its public as well as internal state variables and functions, not even functions that are marked as virtual will be forced by the child contract to implement.You should more search about
inheretance
it is an object-oriented programming concept and it is a fundamental thing that you must know.