The clarifications you are doing in here @jon_m is really helpful man! As a student, it really helps if I know that I’m doing it right or not.
- The base contract is the parent contract from which things are inerited.
- All public and internal scoped functions and state variables are available for derived contracts.
- Hierarchical inheritance is where a single contract is the base contract for multiple child/derived contracts.
-
What is the base contract?
The Parent contract -
Which functions are available for derived contracts?
All public and internal scoped functions and state variables are available to derived contracts. -
What is hierarchical inheritance?
Hierarchical inheritance is when a single contract acts as a base contract for multiple derived contracts.
-
What is the base contract?
Parent Contract where other contracts are inheriting from. -
Which functions are available for derived contracts?
All public and internal scoped functions and state variables are available to derived contracts. -
What is hierarchical inheritance?
When multiple contracts are deriving from one parent contract.
-
What is the base contract?
A contract that can be inherited/derived resulting to child contract. Base/Parent --> Child -
Which functions are available for derived contracts?
Public and internal. -
What is hierarchical inheritance?
A base/parent contract that can be inherited with multiple child contracts.
Example baseContract --> childBaseContract is baseContract --> childBaseContract is childBaseContract
What is the base contract?
The base contract is the parent contract, from which children are derived.
Which functions are available for derived contracts?
internal, public (external if using the blah.function() )
What is hierarchical inheritance?
* A parent with multiple children
A // Parent - base contract
/ \
B C // Children B and C .. or more - derived contracts
-
The base contract sits at the top level of the contract and is also the parent contract. Other contacts are derived or children of the base contract.
-
All public functions and the functions in the contract scope are available to the child or derived contracts
-
Hierarchical inheritance is where a base contract has more that one child contact that use it functionality
1 What is the base contract?
A ‘base’ contract is the parent contract in an inheritance.
2 Which functions are available for derived contracts?
“all public and internal scoped functions and state variables” are available to derived contracts.
3 What is hierarchical inheritance?
Hierarchical inheritance is when one contract is the base for multiple other contracts.
-
The base contract is a contract from which another contract inherits. There is a “is a” relationship between the derived contract and the base contract. This is a form of code re-use.
-
Contracts deriving from a base contract can access all public and internal functions / state variables of the base contract
-
Hierarchical inheritance is the situation where many contracts derive from a single base contract.
- Base contract is a parent contract.
- Public and internal functions of the base contract.
- A single contract can be base for multiple contracts.
Hi @Elekko,
Q1 & Q2
Q3
Your example is actually of multi-level inheritance. An example of hierarchical inheritance with your 3 contracts would be:
contract Base { ... }
contract ChildBaseA is Base { ... }
contract ChildBaseB is Base { ... }
- The base contract is the contract from which the child contracts are derived. I believe this could also be called the Parent contract.
- All public and internal functions are available for derived contracts
- Hierarchical inheritance refers to multiple child contracts derived from a single parent
- The base contract is the contract that is reused in a new contract, is the recycled code.
2.Public and internal scoped functions and state variables are available for derived contracts.
3.Its like the family tree figure instead of the straight line that represents the simple inheritance, so instead of just 1 code inheriting thr base code, theres two or more codes directly inheriting from the base code.
- What is the base contract?
Is the base-level contract of a multiple-level contract structure, also referred as the parent contract.
- Which functions are available for derived contracts?
Public functions and variables are available for inherited contracts
- What is hierarchical inheritance?
It is a contract structure that follows a particular order. Defines the terms parent contract and inherited contracts. Inheritance in general allows for creation of more complex smart contract functionalities.
Hi @Ignacio,
Here are a few comments about your answers. I hope you find them helpful
You certainly understand the concept Have a look at this post for some clarification about which contracts are base contracts in a multi-level inheritance structure.
This is correct, but as well as public functions and public state variables, those with internal visibility are also inherited by derived contracts.
What you have written is correct, but hierarchical inheritance is a term used for one specific type of structure: where a single parent contract is inherited by multiple derived contracts.
- The parent contract
- Public functions and variables that are found in the parent contract
- It’s when several “children” contracts are derived from the same parent
- The contract that is inherited is called parent contract as known as base contract
- All public and internal scoped functions and state variables are available to derived contracts
- In hierarchical inheritance a single contract acts as a base contract for multiple derived contracts.
- Base contract: The parent contract whose information is inherited by child contracts.
- Public / internal scoped functions and variables are available for derived contracts.
- Hierarchical inheritance is when a single parent contract acts as a base contract for multiple child contracts.
- it is the parent contract, it is the contract that is inherited from
- functions that are from the parent contract that are public and internal as well as state variables
- It is the type of inheritance wherein a parent contract is being inherited by 2 or more child contracts
1. What is the base contract?
The base contract is the parent contract
2. Which functions are available for derived contracts?
All public and internal scoped functions and state variables are available to derived contracts
3. What is hierarchical inheritance?
A single contract acts as a base contract for multiple derived contracts