- Base contract is the most senior parent contract in the inheritance chain
- All public and internal scoped functions are available to derived contracts.
- Hierarchical inheritance is when a contract is inherited by more than one child contracts
1. What is the base contract?
It is the parent contract.
2. Which functions are available for derived contracts?
public, internal
3. What is hierarchical inheritance?
A single contract that acts as a base contract for multiple derived contracts.
- What is the base contract?
The parent contract for one or more derived contracts.
- Which functions are available for derived contracts?
internal and public functions
- What is hierarchical inheritance?
A single contract acts as a base contract for multiple derived contracts.
- What is the base contract?
the base contract is any contract that other contracts inherits from (I dont know if thats written correctly). What wanted to say if that any contract A inherits their functions or properties from another contract B, contract B is tha base contract of A - 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 again similar to simple inheritance. Here, however, a single contract acts as a base contract for multiple derived contracts.
- A base contract is the inheritance contract where parent is the base contract.
- The functions that are available for a derived class consists of a parent and child relationship.
- Heirarchical inheritance is the base contract from multiple derived contracts.
-
What is the base contract?
The parent contract is known as a base 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?
A single contract acts as a base contract for multiple derived contracts
Hi @look_y,
Q1
Q3 …
Just to confirm, hierarchical inheritance is where a single base contract has multiple derived contracts.
You seem to be confused about Q2 …
By functions we are referring to the functions coded within a contract i.e.
function doSomething(parameter) public { ... /* function body */ ... }
The functions available for derived contracts (from their inherited parent/base contracts) are those marked with public
or internal
visibility. The example above is marked public
and so would be available in any derived contract. Functions marked private
or external
are not available in derived contracts.
- What is the base contract? parent contract
- Which functions are available for derived contracts? all public and internal scoped
functions - What is hierarchical inheritance? single contract acts as a base contract for multiple derived contracts.
What is the base contract?
- parent contract is known as a base contract
Which functions are available for derived contracts?
- all public and internal scoped functions are available to derived contracts
What is hierarchical inheritance?
- is similar to simple inheritance which inheriting the variables, functions, modifiers, and events of base contracts into the derived class
- The parent contract is also known as the base contract - thus, the answer to this question.
- State, public, internal
- Two derived contracts coming from the same base contract
Hi @RLion,
Q1 and Q2
Q3 …
This is true with all types of inheritance.
Specifically, hierarchical inheritance is where more than one child contract is derived from the same parent contract.
There is no term “simple” inheritance. The simplest form of inheritance is single inheritance, where a single child contract is derived from a single parent contract.
Hi @NeoKanoPheus,
Q1 and Q3
Q2 Which functions are available for derived contracts?
There is no such thing as a state function. The different types of visibility are public, private, internal, and external.
You are correct that functions marked with public and internal visibility are available for derived contracts. In addition, public and internal state variables are also inherited by derived contracts (along with all modifiers and events).
Thank you, Jon … I appreciate your feedback.
1.It is the parent contract.
2.public, internal
3.A single contract that acts as a base contract for multiple derived contracts.
- What is the base contract?
-parent contract is known as a base 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 where a single contract acts as a base contract for multiple derived contracts
-
The base contract is the highest order level contract, or the top parent contract from which all child contracts derive from.
-
Derived contracts inherit all public and internal functions available in the parent contract.
-
Hierarchical inheritance is an inheritance structure in which multiple derived contracts follow from the base contract, but not on multiple levels.
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. ¹
The contract from where other contracts inherit the features called base contract. ²
Those explanations fetched from the articles as far as I understand the definition of base contract. Later I would like to update here with my own words after gaining experiences on contract inheritance practice.
¹ Solidity and object oriented programming (OOP)
² Inheritance In Solidity
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?
Inheritance by multiple derived contracts.
1 The base contract is a parent contract.
2 Functions available for derived contracts are public and internal scoped functions.
3 Hierarchical inheritance is similar to single inheritance but from the base contract, multiple contracts can derive.
- The base contract is contract that was inherited.
- All functions from base contracts are available in derived contract.
- Hierarchical inheritance is when a single contract acts as a base contract for multiple derived contracts.
Hi @Marlic,
Q1 & Q3
No, not all functions in the base 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.