- The base contract is the Parent Contract.
- functions available for derived contracts include, all public and internal in scope, as well as state variables.
- a single base contract acts as a base contract for multiple derived contracts. in other words The Parent Contract (the base contract) has other contracts attached to it called children contracts.
Hi @Pigott,
Q1 & Q2
Q3 âŚ
You are right that hierarchical inheritance is where more than one child contract is derived from the same parent contract. However, each derived contract will not have identical functions to the parent, because:
(i)âAny private or external functions in the parent will not be inherited; and
(ii) Derived contracts will also have their own individual functions which the parent contract doesnât have access to.
YesâŚand just to be clear, itâs the public and internal state variables which are inherited as well (i.e. private state variables are not inherited).
YesâŚand just to be clear, itâs the public and internal state variables which are inherited as well (i.e. private state variables are not inherited).
- What is the base contract?
The inherited parent contract.
- Which functions are available for derived contracts?
All public and internal scoped functions and state variables.
- What is hierarchical inheritance?
Where a single contract acts as a base contract for multiple derived contracts.
Understood, thank you!
- The parent contract in which child contracts inherit from.
- The functions that had been previously stated from the base/parent contract.
- A single contract acts as a base contract for multiple derived contracts.
Hi @Lucus,
Q1 & Q3
Yes, but not all functions in the base/parent contract are inherited. Public and internal functions are available for derived contracts, but not those with private or external visibility. The same is true for state variables and mappings.
Thank you for the correction!
- the base contract = parent contract
- all public and internal scoped function as well as all state variables are available for derived (child) contracts
- hierachical inheritance means there is one parent which acts as base for several child contracts.
- What is the base contract?
The contract has a parent known as the derived class and the parent contract is known as a base contract. - Which functions are available for derived contracts?
There is a is-a relationship between base and derived contracts and all public and internal scoped
functions and state variables are available to derived contracts - What is hierarchical inheritance?
a single contract acts as a base contract for multiple derived contracts.
Contract a{ âŚ
}
Contract b is a{âŚ
}
Contract c is a{
}
- The base contract is that contract which is inherited, also known a parent contract.
- Derived contracts have available all functions from the parent function(s) as well as their own functions.
- Similar to simple inheritance, hierarchical inheritance has a single contract acting as a base contract for multiple derived contracts.
- What is the base contract?
its the parent contract
- Which functions are available for derived contracts?
all public & internal scoped functions, and functions distinct to it
- What is hierarchical inheritance?
multiple derived contracts from a single parent contract
- The parent contract is called based contract.
- Public and internal scoped functions are available in a derived contract.
- A single contract act as a base contract for multiples derived contracts.
Hi @alexsei,
Q1 & Q3
No, not all functions in the base/parent contract are inherited. Public and internal functions are available for derived contracts, but not those with private or external visibility. The same is true for state variables and mappings.
- The base contract is the parent contract.
- Public functions of base contract are available for the derived contracts.
- Hierarchical inheritance is when a single contract acts as base contract for multiple derived contracts.
- What is the base contract?
The contract (parent) that has base functions and state variables which are inherited by the derived contracts. - Which functions are available for derived contracts?
All public and internal functions. - What is hierarchical inheritance?
Where one or more child contracts inherit from a parent contract.
1.Base contract is a parent contract that is inherited variables, functions, modifiers, and events into the derived contracts(child contracts).
2. All public and internal scoped functions and also the state variables are available.
3.Hierrarchica inheritance is the same as simple inheritance, in hierarchical a single contract acts as a base contract for multiple derived contracts.
1. What is the base contract?
The parent contract which can be inherited
2. Which functions are available for derived contracts?
Functions and state variables that have been declared as public or internal
3. What is hierarchical inheritance?
Multiple smart contracts can inherit from the same smart contract.
- What is the base contract?
parent company - 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?
a single contract acts as a base contract for multiple derived contracts.
[/quote]