Skip to main content
Improve formatting
Source Link
Paul Razvan Berg
  • 18.7k
  • 6
  • 79
  • 148

1. Do I need to call the parent constructor in B's constructor to initialize the value owner in A

1. Do I need to call the parent constructor in B's constructor to initialize the value owner in A

Unless you are passing arguments to a constructor, you do not need to explicitly call it. Assigning owner = msg.sender will be evaluated when the contract is deployed

Unless you are passing arguments to a constructor, you do not need to explicitly call it. Assigning owner = msg.sender will be evaluated when the contract is deployed

2. Does B need its own address, or will it just use A's as its own?

2. Does B need its own address, or will it just use A's as its own?

Using Inheritance in Solidity will bundle your code together and deploy it under a single contract

Using Inheritance in Solidity will bundle your code together and deploy it under a single contract

From the Solidity Docssolidity docs:

When a contract inherits from multiple contracts, only a single contract is created on the blockchain, and the code from all the base contracts is copied into the created contract.

1. Do I need to call the parent constructor in B's constructor to initialize the value owner in A

Unless you are passing arguments to a constructor, you do not need to explicitly call it. Assigning owner = msg.sender will be evaluated when the contract is deployed

2. Does B need its own address, or will it just use A's as its own?

Using Inheritance in Solidity will bundle your code together and deploy it under a single contract

From the Solidity Docs:

When a contract inherits from multiple contracts, only a single contract is created on the blockchain, and the code from all the base contracts is copied into the created contract.

1. Do I need to call the parent constructor in B's constructor to initialize the value owner in A

Unless you are passing arguments to a constructor, you do not need to explicitly call it. Assigning owner = msg.sender will be evaluated when the contract is deployed

2. Does B need its own address, or will it just use A's as its own?

Using Inheritance in Solidity will bundle your code together and deploy it under a single contract

From the solidity docs:

When a contract inherits from multiple contracts, only a single contract is created on the blockchain, and the code from all the base contracts is copied into the created contract.

Source Link

1. Do I need to call the parent constructor in B's constructor to initialize the value owner in A

Unless you are passing arguments to a constructor, you do not need to explicitly call it. Assigning owner = msg.sender will be evaluated when the contract is deployed

2. Does B need its own address, or will it just use A's as its own?

Using Inheritance in Solidity will bundle your code together and deploy it under a single contract

From the Solidity Docs:

When a contract inherits from multiple contracts, only a single contract is created on the blockchain, and the code from all the base contracts is copied into the created contract.