{"id":49038,"date":"2024-01-19T04:00:31","date_gmt":"2024-01-19T08:00:31","guid":{"rendered":"https:\/\/101blockchains.com\/?p=49038"},"modified":"2025-03-17T01:06:33","modified_gmt":"2025-03-17T05:06:33","slug":"solidity-inheritance","status":"publish","type":"post","link":"https:\/\/101blockchains.com\/solidity-inheritance\/","title":{"rendered":"What is Inheritance in Solidity?"},"content":{"rendered":"<p style=\"text-align: justify;\"><a href=\"https:\/\/101blockchains.com\/solidity-tutorial\/\" target=\"_blank\" rel=\"noopener\">Solidity<\/a> is a popular programming language for creating <a href=\"https:\/\/101blockchains.com\/smart-contracts\/\" target=\"_blank\" rel=\"noopener\">smart contracts<\/a>. It is one of the most used programming languages for developing smart contracts on <a href=\"https:\/\/101blockchains.com\/ultimate-ethereum-guide\/\" target=\"_blank\" rel=\"noopener\">Ethereum<\/a> and <a href=\"https:\/\/101blockchains.com\/ethereum-virtual-machine\/\" target=\"_blank\" rel=\"noopener\">EVM<\/a>-compatible <a href=\"https:\/\/101blockchains.com\/blockchain-technology-explained\/\" target=\"_blank\" rel=\"noopener\">blockchains<\/a>. One of the important highlights of Solidity is the fact that it features the traits of object-oriented programming languages. Therefore, Solidity inheritance is definitely one of the features that you would find during the implementation of Solidity of <a href=\"https:\/\/101blockchains.com\/smart-contract-development-course-launched\/\" target=\"_blank\" rel=\"noopener\">smart contract development<\/a>.<\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">Inheritance refers to the ability of an object to inherit certain functions, behaviors, and variables from other objects. The applications of inheritance in smart contract development with <a href=\"https:\/\/101blockchains.com\/create-contract-from-another-contract-in-solidity\/\" target=\"_blank\" rel=\"noopener\">Solidity help in creating smart contracts based on another contract<\/a>. It could help in extending the attributes and traits of a specific contract to derived contracts. Let us learn more about inheritance and its role in Solidity with examples.<\/span><\/p>\n<blockquote><p>Are you aspiring to learn the fundamentals of the Ethereum Virtual Machine and smart contracts\u2019 upgradability? Enroll now in the\u00a0<a href=\"https:\/\/101blockchains.com\/course\/advanced-solidity-development\/\" target=\"_blank\" rel=\"noopener\" data-wpel-link=\"internal\">Advanced Solidity Development Course<\/a>.<\/p><\/blockquote>\n<h2 style=\"text-align: left;\"><b>What is Inheritance?<\/b><\/h2>\n<p style=\"text-align: justify;\">Solidity programming involves development of smart contracts with programming. One of the unique highlights of Solidity is the fact that it supports inheritance. You can find answers to \u201cDoes Solidity have inheritance?\u201d in the flexibility for expanding usefulness of smart contracts in Solidity. It is also important to remember that Solidity supports single-rules inheritance alongside multiple inheritance by employing polymorphism. Solidity enables smart contract inheritance with the flexibility for incorporating traits of multiple contracts in one contract.<\/p>\n<p style=\"text-align: justify;\">You can find different types of inheritance in Solidity, such as single, multiple, hierarchical, and multi-level inheritance. Single inheritance points to the situations in which one smart contract inherits the properties of another contract. Multiple inheritance is visible in scenarios where a single contract inherits the traits of multiple contracts simultaneously. Hierarchical inheritance refers to the cases where parent contracts could have more than one child contract. Multi-level inheritance is a variant of single inheritance, albeit with different levels of relationship between the child and parent contracts.<\/p>\n<blockquote>\n<p style=\"text-align: justify;\">Learn about the fundamentals of smart contracts &amp; solidity with <a href=\"https:\/\/101blockchains.com\/ebooks\/solidity-and-smart-contracts\/\" target=\"_blank\" rel=\"noopener\">Solidity &amp; Smart Contracts E-Book\u00a0<\/a><\/p>\n<\/blockquote>\n<h3 style=\"text-align: left;\"><b>Importance of Inheritance in Solidity\u00a0<\/b><\/h3>\n<p style=\"text-align: justify;\">The discussions about inheritance traits of Solidity also draw references to its significance. Whether it is Solidity multiple inheritance or single inheritance, you can find different benefits. First of all, you must note that inheritance is one of the key traits of object-oriented programming languages.<\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">Developers can rely on inheritance to improve the functionality of a program by isolating code, eliminating dependencies, and increasing reusability of existing code. Interestingly, Solidity offers support for inheritance between smart contracts alongside inheritance of multiple contracts into one contract.\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\">Developers could expand the attributes and properties of a parent contract to the derived contracts. In addition, Solidity inheritance example also showcases the facility for modifying the attributed and traits of derived contracts through overriding. Derived contracts could access all the non-private members, such as state variables and internal methods. At the same time, it is also important to note that such functionalities are not permitted in Solidity. When you call functions by using super in multiple inheritance, the most derived contract would have the first preference.<\/p>\n<p style=\"text-align: justify;\">You should also know about the optional availability of Solidity inheritance constructor and the fact that smart contracts have default constructors. Developers could specify constructor arguments in two different ways. The importance of inheritance also points towards marking different contracts associated with a parent-child dynamic. On top of it, the similarity between Solidity and Python in terms of inheritance rules also provides flexibility for transition of programmers to smart contract development tasks.<\/p>\n<blockquote><p>Want to get an in-depth understanding of Solidity concepts? Enroll now in the <a href=\"https:\/\/101blockchains.com\/course\/solidity-fundamentals\/\" target=\"_blank\" rel=\"noopener\">Solidity Fundamentals Course<\/a><\/p><\/blockquote>\n<h3 style=\"text-align: left;\"><b>Working of Inheritance\u00a0<\/b><\/h3>\n<p style=\"text-align: justify;\">The term \u2018inheritance\u2019 refers to the process in which the properties and assets of parents pass to the children. You must compare Solidity inheritance with similar relationships. The base contract is the contract that helps other contracts in inheriting features. On the other hand, the derived contract is the contract that inherits features of the base contract.<\/p>\n<p style=\"text-align: justify;\">The base contract and derived contracts are described as parent and child contracts. However, the working of inheritance in Solidity uses only public and internal modifiers. Here are some of the important highlights in the working of inheritance for Solidity smart contracts.<\/p>\n<ul style=\"text-align: justify;\">\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Apart from internal methods and state variables, derived contracts could access all the other non-private members in smart contracts. However, derived contracts in Solidity do not have the permissions.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\">In any Solidity inheritance example, you must notice that overriding functions can work only if the function signature remains constant.<\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Developers can access the functions of a super contract by using the \u2018super\u2019 keyword or the super contract name.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Solidity could present failure in compilation in scenarios where the output parameters do not align with the input values.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\">In the event of Solidity multiple inheritance, the function calls with \u2018super\u2019 keyword would prioritize the most derived contracts.<\/li>\n<\/ul>\n<blockquote><p>Build your identity as a certified blockchain expert with 101 Blockchains\u2019\u00a0<a href=\"https:\/\/101blockchains.com\/certifications\/\" target=\"_blank\" rel=\"noopener\" data-wpel-link=\"internal\">Blockchain Certifications<\/a>\u00a0designed to provide enhanced career prospects.<\/p><\/blockquote>\n<h3 style=\"text-align: left;\"><b>Polymorphism in Solidity Inheritance<\/b><\/h3>\n<p style=\"text-align: justify;\">The working and importance of inheritance in object-oriented programming ensures promising advantages for the adoption of inheritance in <a href=\"https:\/\/101blockchains.com\/smart-contract-development-course-launched\/\" target=\"_blank\" rel=\"noopener\">smart contract development<\/a>. On top of it, you can also respond to questions like \u201cDoes Solidity have inheritance?\u201d by pointing out the implications of polymorphism. Polymorphism helps in ensuring multiple inheritance in the <a href=\"https:\/\/101blockchains.com\/smart-contract-programming-languages\/\" target=\"_blank\" rel=\"noopener\">popular smart contract programming language<\/a>. The working mechanism of polymorphism could help you understand how inheritance works in different ways for Solidity.<\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">Polymorphism implies that external and internal function calls would always execute functions with the same parameter types and name as the most derived contract in hierarchy of inheritance. Developers can enable polymorphism explicitly on each function within the hierarchy by leveraging the \u2018override\u2019 and \u2018virtual\u2019 keywords.\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\">It is also important to call functions in the higher echelons of inheritance hierarchy by providing explicit specifications for the contract. You can provide explicit specifications for inheritance in Solidity by leveraging the \u201cContractName.functionName()\u201d. You can also utilize the \u201csuper.functionName()\u201d when you want to call functions that are one level higher in a flat inheritance hierarchy.<\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">The implementation of inheritance results in the creation of one smart contract on the <a href=\"https:\/\/101blockchains.com\/blockchain-technology-explained\/\" target=\"_blank\" rel=\"noopener\">blockchain<\/a>. In addition, all the code from base contracts is compiled within the created contract. It would imply that all the internal calls to base contract functions can utilize internal function calls. For example, the \u201csuper.f(\u2026)\u201d call would utilize JUMP instead of a message call.\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\">The review of polymorphism for Solidity multiple inheritance also draws attention to errors like state variable shadowing. Only the derived contracts have permission to declare a state variable in the event of a lack of visible state variable with same name in any base contract.<\/p>\n<blockquote><p>Curious to understand the complete smart contract development lifecycle? Enroll now in <a href=\"https:\/\/101blockchains.com\/course\/smart-contracts-development\/\" target=\"_blank\" rel=\"noopener\">Smart Contracts Development Course<\/a><\/p><\/blockquote>\n<h3 style=\"text-align: left;\"><b>What is Function Overriding?<\/b><\/h3>\n<p style=\"text-align: justify;\">The guides to inheritance in Solidity would be incomplete without focusing on function overriding. Inheriting contracts could override base functions, which are classified as \u2018virtual,\u2019 for changing their behavior. The overriding function should utilize the \u2018override\u2019 keyword in the function header. Here is a Solidity inheritance example to showcase a demonstration of function overriding.<\/p>\n<pre style=\"text-align: justify;\"><b>pragma solidity<\/b><span style=\"font-weight: 400;\"> &gt;=0.5.0 &lt;0.7.0;<\/span>\r\n\r\n<b>contract<\/b><span style=\"font-weight: 400;\"> Base<\/span>\r\n\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><b>function<\/b><span style=\"font-weight: 400;\"> foo() <\/span><b>virtual<\/b> <b>public<\/b><span style=\"font-weight: 400;\"> {}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n\r\n<b>contract<\/b><span style=\"font-weight: 400;\"> Middle <\/span><b>is<\/b><span style=\"font-weight: 400;\"> Base {}<\/span>\r\n\r\n<b>contract<\/b><span style=\"font-weight: 400;\"> Inherited <\/span><b>is<\/b><span style=\"font-weight: 400;\"> Middle<\/span>\r\n\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><b>function<\/b><span style=\"font-weight: 400;\"> foo() <\/span><b>public<\/b> <b>override<\/b><span style=\"font-weight: 400;\"> {}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">In the case of multiple inheritance for <a href=\"https:\/\/101blockchains.com\/solidity-tutorial\/\" target=\"_blank\" rel=\"noopener\">Solidity<\/a> contracts, the most derived base contracts responsible for defining the same function should be specified clearly with the \u2018override\u2019 keyword. You must specify all base contracts defining the same function without being overridden by other base contracts. On top of it, contracts that inherit same function from different unrelated base contracts must explicitly override the function.\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\">The official documentation for Solidity inheritance provides additional insights on function overriding. For example, you don\u2019t need an explicit override specifier in two situations. The first situation involves definition of a function in the common base contract. You would not need an explicit override specifier when you have a unique function for a common base contract capable of overriding other functions.<\/p>\n<p style=\"text-align: justify;\">Should you override functions inherited from multiple base contracts in every case? No, you don\u2019t need direct or indirect function overriding in certain scenarios where all override paths for the signature include a base contract. In addition, it is also important to verify whether the base ensures function implementation without mentioning any function with the signature in the paths from current contract to base contract. Another scenario for avoiding function overriding in Solidity multiple inheritance involves a base contract not implementing the function. Such scenarios also involve mentioning the function at least once in all paths from current contract to the base contract.<\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">You might be wondering about the definition of an override path in function overriding. Override path for a specific signature refers to the path in the inheritance graph starting at the current contract. The endpoint of the override path is a contract that mentions a function that has a signature that does not have overriding capabilities.\u00a0<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">Without marking a function that overrides in the \u2018virtual\u2019 form, derived contracts could not modify the function behavior. On top of it, you must also note that public state variables are capable of overriding external functions. It is possible when the parameter alongside return types of the function could align with the \u2018getter\u2019 function in the variable.\u00a0<\/span><\/p>\n<blockquote><p>Want to know the real-world examples of smart contracts and understand how you can use it for your business? Check the presentation on\u00a0<a href=\"https:\/\/101blockchains.com\/presentations\/examples-of-smart-contracts\/\" target=\"_blank\" rel=\"noopener\" data-wpel-link=\"internal\">Examples Of Smart Contracts<\/a><\/p><\/blockquote>\n<h3 style=\"text-align: left;\"><b>What is Modifier Overriding?<\/b><\/h3>\n<p style=\"text-align: justify;\">Another crucial aspect in discussions about inheritance in Solidity points to modifier overriding. Function modifiers have the capability of overriding each other. Modifier overriding works in a similar fashion as function overriding without any overloading for modifiers. It is important to note that the \u2018virtual\u2019 keyword should be used for the overridden modifier. In addition, the overriding modifier must also feature the \u2018override\u2019 keyword. In the event of multiple inheritance, it is important to provide explicit specifications for all the direct base contracts.<\/p>\n<h3 style=\"text-align: left;\"><b>Role of Constructors in Inheritance<\/b><\/h3>\n<p style=\"text-align: justify;\">The discussions about inheritance for smart contracts in Solidity would also focus on constructors. What is a Solidity inheritance constructor, and what is their importance? Constructors are optional functions that are declared in the \u2018constructor\u2019 keyword and executed at the time of contract development. It serves a crucial role in facilitating effective execution of contract initialization code. State variables must be initialized to specified values for inline initialization or zero before the execution of constructor code.<\/p>\n<p style=\"text-align: justify;\">After deploying a constructor, the final code for the smart contract can be deployed on <a href=\"https:\/\/101blockchains.com\/types-of-blockchain\/\" target=\"_blank\" rel=\"noopener\">blockchain network<\/a>. Any Solidity inheritance example with constructors can show you that deploying the code could result in additional gas costs at the same level as length of the code. The contract code features all the functions included in the public interface. In addition, it also features functions that can be accessible through simple function calls. The contract code does not include constructor code or the internal functions that could be called only from the constructor.<\/p>\n<p style=\"text-align: justify;\">It is also important to note that constructor functions can be classified as \u2018internal\u2019 or \u2018public.\u2019 Without any constructor, the contract would assume the default Solidity inheritance constructor along the lines of \u2018constructor() public {}.\u2019 Here is an example of the use of constructors in Solidity smart contracts.<\/p>\n<pre style=\"text-align: justify;\"><b>pragma solidity<\/b><span style=\"font-weight: 400;\"> &gt;=0.5.0 &lt;0.7.0;<\/span>\r\n\r\n<b>contract<\/b><span style=\"font-weight: 400;\"> A {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0uint <\/span><b>public<\/b><span style=\"font-weight: 400;\"> a;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><b>constructor<\/b><span style=\"font-weight: 400;\">(uint _a) <\/span><b>internal<\/b><span style=\"font-weight: 400;\"> {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0a = _a;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n\r\n<b>contract<\/b><span style=\"font-weight: 400;\"> B <\/span><b>is<\/b><span style=\"font-weight: 400;\"> A(1) {<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0<\/span><b>constructor<\/b><span style=\"font-weight: 400;\">() <\/span><b>public<\/b><span style=\"font-weight: 400;\"> {}<\/span>\r\n\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p style=\"text-align: justify;\"><span style=\"font-weight: 400;\">The constructor defined as \u2018internal\u2019 could help in marking the contract as an \u2018abstract\u2019 one. Before the Solidity version 0.4.22, constructors had to be defined in the form of functions that have similar names as the contract. After version 0.5.0, the syntax for constructors has been deprecated.\u00a0<\/span><\/p>\n<blockquote><p>Master the art of Smart Contract development with Solidity to create innovative web3 applications for diverse use cases as a Solidity expert with\u00a0<a href=\"https:\/\/101blockchains.com\/skill\/solidity\/\" target=\"_blank\" rel=\"noopener\" data-wpel-link=\"internal\">Solidity Skill Path<\/a><\/p><\/blockquote>\n<h3 style=\"text-align: left;\"><b>Is it Possible to Inherit Different Types of Members with Same Name?<\/b><\/h3>\n<p style=\"text-align: justify;\">You should also reflect on answers for \u2018Does Solidity have inheritance?\u2019 with references to possibilities of inheriting different types of members with same name. Developers might encounter errors when specific pairs in smart contracts share the same name owing to inheritance. The pairs include function-modifier, event-modifier, and function-event pairs. On the other hand, you can also find an exception in this case, as a state variable getter could override external functions.<\/p>\n<blockquote><p>Start your journey to become a smart contract developer or architect with an in-depth overview of smart contract fundamentals with\u00a0<a href=\"https:\/\/101blockchains.com\/skill\/smart-contracts\/\" target=\"_blank\" rel=\"noopener\" data-wpel-link=\"internal\">Smart Contracts Skill Path<\/a><\/p><\/blockquote>\n<h3 style=\"text-align: justify;\"><b>Conclusion\u00a0<\/b><\/h3>\n<p style=\"text-align: justify;\">The introduction to inheritance in Solidity provides proof of the flexibility for reusing smart contract code. It is an essential element for <a href=\"https:\/\/101blockchains.com\/become-smart-contract-developer\/\" target=\"_blank\" rel=\"noopener\">smart contract developers<\/a> to recreate successful smart contract functionalities in their applications. On top of it, the features for function overriding and modifier overriding enable developers to introduce custom functionalities.<\/p>\n<p style=\"text-align: justify;\">The support for Solidity multiple inheritance through polymorphism can play a crucial role in empowering scalability for smart contracts. At the same time, you must also notice the importance of constructors for initialization of smart contract code. Learn more about <a href=\"https:\/\/101blockchains.com\/solidity-fundamentals-course-launched\/\" target=\"_blank\" rel=\"noopener\">Solidity fundamentals<\/a> and create your expertise in <a href=\"https:\/\/101blockchains.com\/smart-contract-development-course-launched\/\" target=\"_blank\" rel=\"noopener\">smart contract development<\/a> right now.<\/p>\n<p><a href=\"https:\/\/101blockchains.com\/pricing\/\" target=\"_blank\" rel=\"noopener\"><picture><source srcset=\"https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/01\/Unlock-your-career-with-101-Blockchains-Learning-Programs.webp 1200w,https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/01\/Unlock-your-career-with-101-Blockchains-Learning-Programs-300x25.webp 300w,https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/01\/Unlock-your-career-with-101-Blockchains-Learning-Programs-1024x85.webp 1024w, https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/01\/Unlock-your-career-with-101-Blockchains-Learning-Programs-768x64.png 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" type=\"image\/webp\"><img src=\"https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/01\/Unlock-your-career-with-101-Blockchains-Learning-Programs.png\" height=\"100\" width=\"1200\" srcset=\"https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/01\/Unlock-your-career-with-101-Blockchains-Learning-Programs.png 1200w, https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/01\/Unlock-your-career-with-101-Blockchains-Learning-Programs-300x25.png 300w, https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/01\/Unlock-your-career-with-101-Blockchains-Learning-Programs-1024x85.png 1024w, https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/01\/Unlock-your-career-with-101-Blockchains-Learning-Programs-768x64.png 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" class=\"aligncenter wp-image-43615 size-full sp-no-webp\" alt=\"Unlock your career with 101 Blockchains&#039; Learning Programs\" loading=\"lazy\" decoding=\"async\"  > <\/picture><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Solidity is a popular programming language for creating smart contracts. It is one of the most used programming languages for developing smart contracts on Ethereum and EVM-compatible blockchains. One of the important highlights of Solidity is the fact that it features the traits of object-oriented programming languages. Therefore, Solidity inheritance is definitely one of the<\/p>\n<div class=\"read-more\"><a href=\"https:\/\/101blockchains.com\/solidity-inheritance\/\" title=\"Read More\">Read More<\/a><\/div>\n","protected":false},"author":64,"featured_media":49040,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1881],"tags":[],"class_list":{"0":"post-49038","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-solidity-smart-contracts"},"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>What is Inheritance in Solidity? - 101 Blockchains<\/title>\n<meta name=\"description\" content=\"The value of inheritance in Solidity is similar to that of other object-oriented programming languages. Learn about the fundamentals of Solidity inheritance now.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/101blockchains.com\/solidity-inheritance\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Inheritance in Solidity?\" \/>\n<meta property=\"og:description\" content=\"Solidity is a popular programming language for creating smart contracts. It is one of the most used programming languages for developing smart contracts\" \/>\n<meta property=\"og:url\" content=\"https:\/\/101blockchains.com\/solidity-inheritance\/\" \/>\n<meta property=\"og:site_name\" content=\"101 Blockchains\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/101Blockchains\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-19T08:00:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-17T05:06:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/10\/Solidity-Inheritance-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"580\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Georgia Weston\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@101Blockchains\" \/>\n<meta name=\"twitter:site\" content=\"@101Blockchains\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Georgia Weston\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/\"},\"author\":{\"name\":\"Georgia Weston\",\"@id\":\"https:\\\/\\\/101blockchains.com\\\/#\\\/schema\\\/person\\\/fbc2e4d2ed4f0110630cff03a75bb1f8\"},\"headline\":\"What is Inheritance in Solidity?\",\"datePublished\":\"2024-01-19T08:00:31+00:00\",\"dateModified\":\"2025-03-17T05:06:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/\"},\"wordCount\":2156,\"publisher\":{\"@id\":\"https:\\\/\\\/101blockchains.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/101blockchains.com\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/Solidity-Inheritance-1.png\",\"articleSection\":[\"Solidity &amp; Smart Contracts\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/\",\"url\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/\",\"name\":\"What is Inheritance in Solidity? - 101 Blockchains\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/101blockchains.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/101blockchains.com\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/Solidity-Inheritance-1.png\",\"datePublished\":\"2024-01-19T08:00:31+00:00\",\"dateModified\":\"2025-03-17T05:06:33+00:00\",\"description\":\"The value of inheritance in Solidity is similar to that of other object-oriented programming languages. Learn about the fundamentals of Solidity inheritance now.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/#primaryimage\",\"url\":\"https:\\\/\\\/101blockchains.com\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/Solidity-Inheritance-1.png\",\"contentUrl\":\"https:\\\/\\\/101blockchains.com\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/Solidity-Inheritance-1.png\",\"width\":1200,\"height\":580,\"caption\":\"solidity inheritance\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/101blockchains.com\\\/solidity-inheritance\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/101blockchains.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is Inheritance in Solidity?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/101blockchains.com\\\/#website\",\"url\":\"https:\\\/\\\/101blockchains.com\\\/\",\"name\":\"101 Blockchains\",\"description\":\"Your guide to the Blockchain World\",\"publisher\":{\"@id\":\"https:\\\/\\\/101blockchains.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/101blockchains.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/101blockchains.com\\\/#organization\",\"name\":\"101 Blockchains\",\"url\":\"https:\\\/\\\/101blockchains.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/101blockchains.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/101blockchains.com\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/image_2021_02_25T10_04_45_211Z.png\",\"contentUrl\":\"https:\\\/\\\/101blockchains.com\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/image_2021_02_25T10_04_45_211Z.png\",\"width\":183,\"height\":175,\"caption\":\"101 Blockchains\"},\"image\":{\"@id\":\"https:\\\/\\\/101blockchains.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/101Blockchains\",\"https:\\\/\\\/x.com\\\/101Blockchains\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/101blockchains\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/101blockchains.com\\\/#\\\/schema\\\/person\\\/fbc2e4d2ed4f0110630cff03a75bb1f8\",\"name\":\"Georgia Weston\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d1e6a76103e62f75b3775ecf1f394067f7357215177215fbdd00bc227690e6e0?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d1e6a76103e62f75b3775ecf1f394067f7357215177215fbdd00bc227690e6e0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d1e6a76103e62f75b3775ecf1f394067f7357215177215fbdd00bc227690e6e0?s=96&d=mm&r=g\",\"caption\":\"Georgia Weston\"},\"description\":\"Georgia Weston is one of the most prolific thinkers in the blockchain space. In the past years, she came up with many clever ideas that brought scalability, anonymity and more features to the open blockchains. She has a keen interest in topics like Blockchain, NFTs, Defis, etc., and is currently working with 101 Blockchains as a content writer and customer relationship specialist.\",\"sameAs\":[\"https:\\\/\\\/101blockchains.com\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/georgia-weston\\\/\"],\"url\":\"https:\\\/\\\/101blockchains.com\\\/author\\\/georgiaweston\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"What is Inheritance in Solidity? - 101 Blockchains","description":"The value of inheritance in Solidity is similar to that of other object-oriented programming languages. Learn about the fundamentals of Solidity inheritance now.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/101blockchains.com\/solidity-inheritance\/","og_locale":"en_US","og_type":"article","og_title":"What is Inheritance in Solidity?","og_description":"Solidity is a popular programming language for creating smart contracts. It is one of the most used programming languages for developing smart contracts","og_url":"https:\/\/101blockchains.com\/solidity-inheritance\/","og_site_name":"101 Blockchains","article_publisher":"https:\/\/www.facebook.com\/101Blockchains","article_published_time":"2024-01-19T08:00:31+00:00","article_modified_time":"2025-03-17T05:06:33+00:00","og_image":[{"width":1200,"height":580,"url":"https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/10\/Solidity-Inheritance-1.png","type":"image\/png"}],"author":"Georgia Weston","twitter_card":"summary_large_image","twitter_creator":"@101Blockchains","twitter_site":"@101Blockchains","twitter_misc":{"Written by":"Georgia Weston","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/101blockchains.com\/solidity-inheritance\/#article","isPartOf":{"@id":"https:\/\/101blockchains.com\/solidity-inheritance\/"},"author":{"name":"Georgia Weston","@id":"https:\/\/101blockchains.com\/#\/schema\/person\/fbc2e4d2ed4f0110630cff03a75bb1f8"},"headline":"What is Inheritance in Solidity?","datePublished":"2024-01-19T08:00:31+00:00","dateModified":"2025-03-17T05:06:33+00:00","mainEntityOfPage":{"@id":"https:\/\/101blockchains.com\/solidity-inheritance\/"},"wordCount":2156,"publisher":{"@id":"https:\/\/101blockchains.com\/#organization"},"image":{"@id":"https:\/\/101blockchains.com\/solidity-inheritance\/#primaryimage"},"thumbnailUrl":"https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/10\/Solidity-Inheritance-1.png","articleSection":["Solidity &amp; Smart Contracts"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/101blockchains.com\/solidity-inheritance\/","url":"https:\/\/101blockchains.com\/solidity-inheritance\/","name":"What is Inheritance in Solidity? - 101 Blockchains","isPartOf":{"@id":"https:\/\/101blockchains.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/101blockchains.com\/solidity-inheritance\/#primaryimage"},"image":{"@id":"https:\/\/101blockchains.com\/solidity-inheritance\/#primaryimage"},"thumbnailUrl":"https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/10\/Solidity-Inheritance-1.png","datePublished":"2024-01-19T08:00:31+00:00","dateModified":"2025-03-17T05:06:33+00:00","description":"The value of inheritance in Solidity is similar to that of other object-oriented programming languages. Learn about the fundamentals of Solidity inheritance now.","breadcrumb":{"@id":"https:\/\/101blockchains.com\/solidity-inheritance\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/101blockchains.com\/solidity-inheritance\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/101blockchains.com\/solidity-inheritance\/#primaryimage","url":"https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/10\/Solidity-Inheritance-1.png","contentUrl":"https:\/\/101blockchains.com\/wp-content\/uploads\/2023\/10\/Solidity-Inheritance-1.png","width":1200,"height":580,"caption":"solidity inheritance"},{"@type":"BreadcrumbList","@id":"https:\/\/101blockchains.com\/solidity-inheritance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/101blockchains.com\/"},{"@type":"ListItem","position":2,"name":"What is Inheritance in Solidity?"}]},{"@type":"WebSite","@id":"https:\/\/101blockchains.com\/#website","url":"https:\/\/101blockchains.com\/","name":"101 Blockchains","description":"Your guide to the Blockchain World","publisher":{"@id":"https:\/\/101blockchains.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/101blockchains.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/101blockchains.com\/#organization","name":"101 Blockchains","url":"https:\/\/101blockchains.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/101blockchains.com\/#\/schema\/logo\/image\/","url":"https:\/\/101blockchains.com\/wp-content\/uploads\/2021\/03\/image_2021_02_25T10_04_45_211Z.png","contentUrl":"https:\/\/101blockchains.com\/wp-content\/uploads\/2021\/03\/image_2021_02_25T10_04_45_211Z.png","width":183,"height":175,"caption":"101 Blockchains"},"image":{"@id":"https:\/\/101blockchains.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/101Blockchains","https:\/\/x.com\/101Blockchains","https:\/\/www.linkedin.com\/company\/101blockchains\/"]},{"@type":"Person","@id":"https:\/\/101blockchains.com\/#\/schema\/person\/fbc2e4d2ed4f0110630cff03a75bb1f8","name":"Georgia Weston","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d1e6a76103e62f75b3775ecf1f394067f7357215177215fbdd00bc227690e6e0?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d1e6a76103e62f75b3775ecf1f394067f7357215177215fbdd00bc227690e6e0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d1e6a76103e62f75b3775ecf1f394067f7357215177215fbdd00bc227690e6e0?s=96&d=mm&r=g","caption":"Georgia Weston"},"description":"Georgia Weston is one of the most prolific thinkers in the blockchain space. In the past years, she came up with many clever ideas that brought scalability, anonymity and more features to the open blockchains. She has a keen interest in topics like Blockchain, NFTs, Defis, etc., and is currently working with 101 Blockchains as a content writer and customer relationship specialist.","sameAs":["https:\/\/101blockchains.com\/","https:\/\/www.linkedin.com\/in\/georgia-weston\/"],"url":"https:\/\/101blockchains.com\/author\/georgiaweston\/"}]}},"_links":{"self":[{"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/posts\/49038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/users\/64"}],"replies":[{"embeddable":true,"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/comments?post=49038"}],"version-history":[{"count":8,"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/posts\/49038\/revisions"}],"predecessor-version":[{"id":51821,"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/posts\/49038\/revisions\/51821"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/media\/49040"}],"wp:attachment":[{"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/media?parent=49038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/categories?post=49038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/101blockchains.com\/wp-json\/wp\/v2\/tags?post=49038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}