Inheritance Reading Assignment

Hi @Nicksta,

Q1  :white_check_mark:

This first sentence is the correct answer  :white_check_mark:

No, hierarchical inheritance is where more than one child contract is derived from the same parent contract.

Hi @josephg,

Q1  :white_check_mark:

Q2 …

No, 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.

Q3 …

I think you have the right idea, I think it’s just a problem with how you’ve worded it. It should be either:
Contract A is inherited by both Contract B and Contract C
or
Both Contract B and Contract C are derived from Contract A

Hierarchical inheritance is where more than one child contract is derived from the same parent contract.

1 Like
  1. a contract from which another one is derived
  2. public and inernal
  3. inheritance where a hierarchy is former. elgl contracts B & C both inherit from A. Contracts D & E could both inherit from B and contracts F & G could inherit from C in order to continue the hierarchy.
1 Like
  1. Base contract is a parent class that is inherited by another contract.
  2. Public and internal scope contracts are available for derived contracts.
  3. In hierarchical inheritance multiple contracts can inherit from one base contract.
1 Like

thanks!! this helps me a lot

1 Like

Q1. What is the base contract?
The contract that is inherited is called the parent contract and the contract that inherits is called the child contract. Parent contract is known as a base contract.

Q2. Which functions are available for derived contracts?
All public and internal scoped functions and state variables of the parent contract/s are available to derived contracts.

Q3. What is hierarchical inheritance?
In hierarchical inheritance a single contract acts as a base contract for multiple derived contracts.

contract B is A{

}

contract C is A{

}

1 Like

Correct, thanks for the acclaration!

1 Like
  1. What is the base contract? A parent contract of the derived class, that which child contracts are derived from.

  2. Which functions are available for derived contracts? Public and internal scoped functions

  3. What is hierarchical inheritance? A contract composition where multiple child contracts are derived from a single parent contract as the source of inheritance.

1 Like

What is the base contract?
Base (or parent) contracts are the ones from which other derived (or child) contracts inherit

Which functions are available for derived contracts?
All public and internal scoped functions. Also state variables, modifiers, and events of base contracts

What is hierarchical inheritance?
Whereby a single contract acts as a base (parent) contract for multiple derived (child) contracts.

1 Like
  1. Parent contract.
  2. Public and internal.
  3. A single contract acts as a base for multiple derived contracts.
2 Likes
  1. We can call base contract also parent contract. This is the contract that is inherited by other contracts (child contracts).
  2. All Public and Internal scoped functions are available for derived contracts.
  3. Hierarchical inheritance is similar to single inheritance but a single contract acts as a base contract for multiple derived contracts
1 Like
  1. What is the base contract?
    the parent contract from which child(derived) contracts inherit from.

  2. Which functions are available for derived contracts?
    derived contracts can use all functions in is own and public/internal functions of the parents classes.

  3. What is hierarchical inheritance?
    it’s when multiple derived contracts inherit from the same base contract.

1 Like
  1. What is the base contract?
    A base contract is the parent in the parent-child relationship that is inherited by another contract.
  2. Which functions are available for derived contracts?
    All the public functions of the parent contract.
  3. What is hierarchical inheritance?
    Where two contracts will derive from one base contract.
1 Like
  1. What is the base contract?
    The base contract is the contract from which all other child contracts are derived.

  2. Which functions are available for derived contracts?
    All public and internal scoped functions are available to derived contracts.

  3. What is hierachical inheritance?
    A hierachical inheritance is where the base contract is the parent of multiple derived contracts. This is in contrast to single or multi-level inheritance, where the base contract is only a parent to its direct decendant.

1 Like
  1. A base contact is a parent contract from which the children are derived.
  2. Public and internal scoped functions
  3. Multiple child contracts inheriting from a single parent contract.
1 Like
  1. What is the base contract?

The parent contract that other contracts inherit from.

  1. Which functions are available for derived contracts?

Public and internal.

  1. What is hierarchical inheritance?

When multiple contracts use same parent contract.

1 Like
  1. What is the base contract?
    The parent contract.
  2. Which functions are available for derived contracts?
    All public and internal scoped functions.
  3. What is hierarchical inheritance?
    It is when a parent contract acts as base contract for multiple child contracts
1 Like

Base contract is the parent with other contracts inheriting its functions and variables.
Public and internal functions are inherited.
all the new contracts that extend the base posses identical functions to the parent.

1 Like
  1. Base contract is referred to as the parent contract or the contract which is inherited.

  2. All public, internal functions and state variables as well.

  3. Multiple contracts inherits the single contract.

1 Like
  1. It is the parent contract. It is inherited and has children contracts.
  2. All public and internal scoped functions and state variables are available to derived contracts.
  3. A single contract has multiple derived contracts.
1 Like