Hey jon, I appreciate the clarification !!!
- What is the base contract? The parent contract.
- Which functions are available for derived contracts? Everything from the base contract is copied in the derived contract
- What is hierarchical inheritance?
contract A{}
contract B is A{}
contract C is A{}
Hi @vili,
Q1 & Q3
No⌠not everything in the base contract is inherited:
-
Functions with public or internal visibility are available for derived contracts. But functions with private or external visibility are not inherited.
-
Similarly, state variables with public or internal visibility are inherited, but not those marked private. (Note: state variables canât have external visibility)
-
All modifiers and events are available for derived contracts.
Let me know if anything is unclear, or if you have any questions
- The base contract (aka parent contract) is that contract that provides for inheritance. Derived class contracts (child contracts) inherit from the base contract.
- All public and internal functions are available to derived contracts.
- Hierarchical inheritance is when a base contract provides for multiple sets of simple inheritance contract flows.
- Base contract is the parent contract from which the child contract is inherited.
2.All public and internal functions.
3.A parent contract being inherited to two different contracts.
Nice answers @Kippie
By the way, the article uses both single and simple inheritance to refer to the same inheritance structure. As far as I am aware, the correct term is single inheritance (and calling it simple inheritance is an error).
Hi @Deini-Atakan,
Your answers are correct, but I just want to clarify a couple of thingsâŚ
The base contract is inherited by the child contract.
The child contract inherits the base contract
From your answer, I think you do know this, and itâs just a confusion with how the verb inherit works in EnglishâŚ
I hope you donât mind me pointing it out.
This is correct, but more than two different contracts can inherit from the same parent as well.
Hierarchical inheritance is where more than one (multiple) derived contracts all inherit from the same, single parent contract.
Just let me know if you have any questions
Hi, @jon_m I still have some questions, I would really appreciate it if you can answer them.
I didnât quite get this part. Is the base contract first inherited version of the contract?
And for this part I totally forgot to write âor moreâ after two while explaining but thanks for pointing it out.
1-the base contact os the parent contract
2-all public and internal scoped functions are available
3-a single contract acts as a base contract for multiple derived contracts
Hi Atakan,
The base contract (or parent contract) is inherited by the derived contract (or child contract). This means that when we deploy the derived contract, the following functionality in the base contract is also made available within the derived contract:
- public and internal functions
- public and internal state variables (including arrays and mappings)
- all events and modifiers
The base contract doesnât need to be deployed for this functionality to be available within the deployed derived contract.

The base contract is inherited by the child contract.
The child contract inherits the base contract
These are just 2 alternative ways of saying the same thing in English.
Sorry, if I confused you. Does that make sense now?
Hi @jon_m, to be honest, it still is kind of messed up in my head, either English making it seem hard to understand or I donât get it. I understood how to use it but I still am not sure what to call what. For example, if I have a destroyable.sol contract which has destroyable contract in it. When I call that function inside destroyable contract from another contract, what should I call them? I hope I asked properly.
Hey @jon_m, yeah I missed that bit on Q2, I gotta get used to specifying the visibility when describing functions. And regarding the Q3 I thought they meant that multiple contracts derived from the same parent is one feature of hierarchical inheritance, didnât it was the main feature. Thanks for your help
Hi Atakan,

to be honest, it still is kind of messed up in my head,
Donât worry, thatâs quite normal with these kinds of concepts⌠it can take a while to work out whatâs really going on
I think what may be confusing you is that in our assignment example we are not deploying the Ownable or the Destroyable contracts. When we deploy the derived contract Bank, because Bank inherits from Destroyable, the destroy() function in Destroyable is available within the deployed Bank contract. Or put another way, Bank inherits the destroy() function from Destroyable.
So, when the destroy() function is called (in our example, by the contract ownerâs external wallet address), it is being called on the deployed Bank contract (where itâs available by inheritance from Destroyable). The Bank contract doesnât call the function on Destroyable, because itâs already available in Bank by inheritance â and available to be called externally because it has public visibility.
Bank is the derived (or child) contract which inherits from Destroyable (the base contract, or parent contract)
or to say it another way in EnglishâŚ
Destroyable is the base (or parent contract) which is inherited by Bank (the derived, or child contract).
The flow of inheritance goes from Ownable => Destroyable => Bank
This is a multi-level inheritance structure (3 levels) âŚ
contract Ownable {...}
contract Destroyable is Ownable {...}
// Destroyable (Derived/Child) inherits from Ownable (Base/Parent)
contract Bank is Destroyable {...}
// Bank (Derived/Child) inherits from Destroyable (Base/Parent)
Notice that in this multi-level inheritance structure, Destroyable is both a child of Ownable and a parent of Bank.
Any clearer?
It definitely is clearer now but I still probably wonât be able to explain it to someone yet. I get what they mean but explaining is a whole another level . Thank you so much @jon_m

It definitely is clearer now
Well thatâs good progress

but I still probably wonât be able to explain it to someone yet.
One step at a time, Atakan ⌠youâll get there. Just know that some more complicated concepts do take a while before they truely click and you are able to explain them clearly to others. Keep persevering ⌠youâre doing great
Hello
Here are my answers for the assignment.
- A base contract is the parent contract in the inheritance tree.
- All of the functions from the base or parent contract.
- The derived contracts inherit directly from the base contract.
Hi @darthgawd
Q1
Q2â Which functions are available for derived contracts?

- All of the functions from the base or parent contract.
No⌠functions with public or internal visibility are inherited, but those with private or external visibility are not.
Q3â What is hierarchical inheritance?

- The derived contracts inherit directly from the base contract.
While this is true, the key feature of hierarchical inheritance is that more than one (multiple) derived contracts inherit from the same, single base contract.
Let me know if anything is unclear, or if you have any questions
Jon. I got it now, thank you for the response.
- The base contract refers to the parent contract in the line of inheritance.
- Functions that are available for derived contracts include functions that are public and are internal within the base contract.
- Hierarchical structure allows for one or more child contracts to inherit from the same parent contract.
Hi @loso,
Q1 & Q2
Q3

- Hierarchical structure allows for one or more child contracts to inherit from the same parent contract.
Nearly⌠hierarchical inheritance is where more than one (i.e. multiple) child contracts inherit from the same, single parent contract.
Where there is only one child contract which inherits from a single parent contract, this is known as single inheritance.
Let me know if you have any questions