5/5
_You can follow along with the video course from here._ ### Introduction This section covered how to deploy contracts, how to import and interact with them, and using inheritance to customize their functionalities. ### Deploying and importing We delved into the use of the **`new`** keyword to deploy multiple instances of a contract, allowing for the creation of numerous contract instances as needed. Contracts can also be **imported**, which is equivalent to copying the code into the file but with the advantage of enhanced code reusability and modularity. It's good practice to use _named imports_, selecting only the contracts we intend to use from the file. ```solidity import { Contract as MyContract } from './myOtherContract.sol'; ``` ### Contracts interaction Solidity lets you interact with other contracts. To do so we need the contract's address and its ABI (Application Binary Interface): ```solidity contract AddFiveStorage is SimpleStorage {} ``` ### Inheritance and overriding A contract can also derive functions from other contracts through **inheritance**. This can be obtained through the `is` keyword. To explicitly override a function from the parent contract, the `override` keyword is used in the child method. The parent's function must be marked as `virtual` to allow this interaction. ```solidity //child contract import './ParentContract.sol'; contract ChildContract is ParentContract { function store(uint256 _num) public override {} } ``` ```solidity //parent contract function store(uint256 _num) public virtual { // function body } ``` ### Conclusion In this section, we explored deploying multiple contract instances using the `new` keyword and enhancing code reusability through contract _imports_. We also covered interacting with other contracts using their address and ABI. Additionally, we learned about inheritance and function overriding, allowing derived contracts to customize inherited functionalities. đĄ **TIP**:br When you finish a section, take a moment to acknowledge your progress, celebrate it and share your achievements with your community. ### đ§âđ» Test yourself đ Attempt to answer all the theoretical questions from lesson 1 through 7, and then go back again to complete all the coding tasks.
You can follow along with the video course from here.
This section covered how to deploy contracts, how to import and interact with them, and using inheritance to customize their functionalities.
We delved into the use of the new
keyword to deploy multiple instances of a contract, allowing for the creation of numerous contract instances as needed.
Contracts can also be imported, which is equivalent to copying the code into the file but with the advantage of enhanced code reusability and modularity. It's good practice to use named imports, selecting only the contracts we intend to use from the file.
Solidity lets you interact with other contracts. To do so we need the contract's address and its ABI (Application Binary Interface):
A contract can also derive functions from other contracts through inheritance. This can be obtained through the is
keyword.
To explicitly override a function from the parent contract, the override
keyword is used in the child method. The parent's function must be marked as virtual
to allow this interaction.
In this section, we explored deploying multiple contract instances using the new
keyword and enhancing code reusability through contract imports. We also covered interacting with other contracts using their address and ABI. Additionally, we learned about inheritance and function overriding, allowing derived contracts to customize inherited functionalities.
đĄ TIP:br
When you finish a section, take a moment to acknowledge your progress, celebrate it and share your achievements with your community.
đ Attempt to answer all the theoretical questions from lesson 1 through 7, and then go back again to complete all the coding tasks.
A summary and recap of the lessons covering deploying contracts using the 'new' keyword, importing contracts, named imports, interacting with contracts using ABI, and contract inheritance in Solidity. The lesson celebrates progress made and encourages continued learning.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Blockchain developer fundamentals
Smart contract ABI
Solidity Smart contract development
Solidity Safemath
Solidity custom errors
Solidity inheritance
Solidity gas optimization techniques
Solidity and Ethereum developer workflow
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Guest lecturers:
Last updated on June 26, 2025
Duration: 1h 46min
Duration: 38min
Duration: 2h
Duration: 23min
Course Overview
About the course
Blockchain developer fundamentals
Smart contract ABI
Solidity Smart contract development
Solidity Safemath
Solidity custom errors
Solidity inheritance
Solidity gas optimization techniques
Solidity and Ethereum developer workflow
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Guest lecturers:
Last updated on June 26, 2025