Inheritance: A Complete Guide to Understanding This Blockchain Concept

The is keyword is used to derive a contract from another contract.

In the following example, valueChecker2 is derived from the valueChecker contract.

A Complete Guide to Understanding This Blockchain Concept

The derived contract has access to all non-private members of the parent contract: pragma solidity ^0.4.0; contract valueChecker uint8 price = 20; event valueEvent(bool returnValue); function Matcher(uint8 x) public returns (bool) if (x>=price) valueEvent(true); return true; contract valueChecker2 is valueChecker function Matcher2() public view returns (uint) return price+10; In the preceding example, if the uint8 price = 20 is changed to uint8 private price = 20, then it will not be accessible by the valueChecker2 contract.

This is because now the member is declared as private, it is not allowed to be accessed by any other contract.

The error message that you will see in Remix is browser/valuechecker.sol:20:8: DeclarationError: Undeclared identifier.

Inheritance Inheritance is supported in Solidity. The is keyword is used to derive a contract from another contract. In the following example, valueChecker2 is derived from the valueChecker contract. The derived contract has access to all non-private members of the parent contract: pragma solidity ^0.4.0; contract valueChecker uint8 price = 20; event valueEvent(bool returnValue); function Matcher(uint8 x) public returns (bool) if (x>=price) valueEvent(true); return true; contract valueChecker2 is valueChecker function Matcher2() public view returns (uint) return price+10; In the preceding example, if the uint8 price = 20 is changed to uint8 private price = 20, then it will not be accessible by the valueChecker2 contract. This is because now the member is declared as private, it is not allowed to be accessed by any other contract. The error message that you will see in Remix is browser/valuechecker.sol:20:8: DeclarationError: Undeclared identifier. return price+10; ^—^

Why This Matters for Blockchain Technology

Understanding Inheritance is not just an academic exercise — it has real-world implications for how blockchain systems are designed, deployed, and secured. Whether you are a developer building decentralized applications, a business leader evaluating blockchain adoption, or a curious learner exploring the technology, this knowledge provides a critical foundation.

Key Points to Remember

  • The is keyword is used to derive a contract from another contract.
  • In the following example, valueChecker2 is derived from the valueChecker contract.
  • This is because now the member is declared as private, it is not allowed to be accessed by any other contract.
  • The error message that you will see in Remix is browser/valuechecker.sol:20:8: DeclarationError: Undeclared identifier.

Conclusion

Inheritance represents one of the many innovative layers that make blockchain technology so powerful and transformative. As distributed systems continue to evolve, a solid understanding of these core concepts becomes increasingly valuable — not just for developers, but for anyone building, investing in, or working alongside blockchain-powered systems.

Whether you are just starting your blockchain journey or deepening existing expertise, mastering these fundamentals gives you the tools to think clearly about decentralized systems and make smarter decisions in this rapidly evolving space.