Inheritance Reading Assignment

1The base contract is the parent contract
2.Public , internal and state variables are available to the derived contracts
3.a single contract acts as a base contract for multiple derived contracts.

1 Like
  1. What is the base contract?
    The parent contract whose functions and variables are inherited by child contracts.
  2. Which functions are available for derived contracts?
    Public and internal scoped functions and state variables are available to derived contracts.
  3. What is hierarchical inheritance?
    A single contract acts as a parent to multiple child contracts.
1 Like
  1. What is the base contract? - Parent contract
  2. Which functions are available for derived contracts? - variables, functions, modifiers, and events
  3. What is hierarchical inheritance? - a single contract acts as a base contract for multiple derived contracts
2 Likes

What is the base contract?
• Another way of saying parent contract
Which functions are available for derived contracts?
• All public and internal function, and the function defined in the derived contract itself
What is hierarchical inheritance?
• A base contract acts as a parent for multiple children, creating a tree-like structure

1 Like
  1. What is the base contract?
    The base contract is the original parent contract - containing the information that is inherited.

  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 similar to simple inheritance. Here however, a single contract acts as a base contract for multiple derived contracts.

  • I have a question about the direction of the arrows in the diagrams of the blog post (reading assignment). In the Single, Multi-level, and Hierarchical inheritance diagrams, the arrows seem to originate at the child contract(s) and point toward the parent contract, seemingly pointing to where the contract info was derived FROM. In contrast, in the Multiple Inheritance diagram the arrows originate at the parent contract and point toward the child contracts. This seems to represent the flow of information more understandably.
    Any thoughts / clarifications?
2 Likes
  1. What is the base contract?
  • It is also known as the parent contract or the contract where other contracts are derived from
  1. Which functions are available for derived contracts?
  • Functions that are public and internal scoped, and state variables are available to the derived (child) contracts.
  1. What is hierarchical inheritance?
  • Hierarchical inheritance happens when multiple child-contracts have one parent (base) contract.
1 Like
  • What is the base contract?
    The base contract is the contract that is inherited. aka the parent contract.
contract SampleA {
// I'm the base contract call me Parent
}
contract SampleB is SampleA {
// I'm the derived contract. I inherit from Parent contract call me Child
}
  • Which functions are available for derived contracts?
    All local functions and state variables are available for derived contracts.

  • What is hierarchical inheritance?
    Hierarchical inheritance is when a single contract is the base for multiple derived contracts.

contract ExampleA {
// base contract 
}
contract ExampleB is ExampleA {
//derived - inherit  from base 
}
contract ExampleC is ExampleA {
//derived - inherit from base 
}
1 Like
  1. What is the base contract?
    the base contract is the parent contract in a parent-child contract relationship, it it the contract that child contracts are based off.

  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?
    this is when there a single base contract for multiple derived contracts.

1 Like
  1. What is the base contract?
    A. A parent contract
  2. Which functions are available for derived contracts?
    A. Public, internal scoped & state variables
  3. What is hierarchical inheritance?
    A. Mom contract , daughter contract, granddaughter contract, great granddaughter contract
1 Like
  1. The contract that is inherited is called the parent contract , also is known as a base contract, and inherits variables, functions, modifiers, and events into the derived class.

  2. All public and internal scoped functions and state variables are available to derived contracts.

  3. Hierarchical is the inheritance in which a single parent contract acts as a base for multiple derived contracts.

1 Like
  1. What is the base contract?
    It’s the parent contract in a inheritance relationship.
  2. Which functions are available for derived contracts?
    Those declared as public or internal.
  3. What is hierarchical inheritance?
    It’s a type of inheritance having at least two children contracts inherited from the same base contract.
1 Like
  1. What is the base contract?

To explain base contract first need to explain inheritance. Inheritance is the process of defining multiple contracts that are related to each other through parent-child relationships. The contract that is inherited is called the parent contract and the contract that inherits is called the child contract. Similarly, the contract has a parent known as the derived class and the parent contract is known as a base contract.

  1. Which functions are available for derived contracts?

All public and internal scoped functions and state variables are available to derived contracts.

  1. What is hierarchical inheritance?

It is when single contract acts as a base contract for multiple derived contracts.

1 Like
  1. It is the parent contract, the contract which other contract inherits from
  2. All public and internal scoped functions and state variables are available to derived contracts
  3. Multiple child contracts derives from a single base contract
1 Like
  1. A base contract is a parent contract.

  2. Functions that are available for derived contracts are public and internal scoped functions.

  3. In hierarchical inheritance, a single contract acts as a base contract for multiple derived contracts. In simpler term, it is like parent-multiple children relationship.

1 Like

1. What is the base contract? It is the original contract where other’[s are derived from (Parent)
2. Which functions are available for derived contracts? All public and internal functions are available from a derived contract.
3. What is hierarchical inheritance? where all child contracts associated with a single originated contract get its base from.

1 Like

1)Parent contract is known as base contract
2)All public and internal scoped functions and state variables are available to derived contracts
3)Hierarchical inheritance means where single contract acts as a base contract for multiple derived contracts

1 Like

1. the base contract is also called the parent contract as in a parent - child contract relationship. This is inheritance and basically its the process of defining multiple contracts that are related to each other. It’s mostly about code reusability.

2. There is a relationship between base and derived contracts and all public and internal scoped functions and state variables are available to derived contracts.

3. This is when a single contract acts as a base contract for multiple derived contracts.
Logic would be: contract A is parent, contract B and C are child’s of A.

1 Like
  1. Parent contract
  2. All public and internal functions
  3. It is similar to simple inheritance but a single contract acts as a base contract for multiple derived contracts.
1 Like
  1. The parent contract that gets inherited from.
  2. All public and internal functions
  3. When a single base contracts provides inheritance for multiple deriving contracts.
1 Like
  1. Parent contract from which the child contract derives.

  2. All public and internal scoped functions and state variables.

  3. Is a single contract that acts as a base contract for multiple derived contracts.

1 Like