{"id":3850,"date":"2022-12-05T06:56:18","date_gmt":"2022-12-05T06:56:18","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=3850"},"modified":"2022-12-05T06:56:19","modified_gmt":"2022-12-05T06:56:19","slug":"hierarchical-inheritance-in-python","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/hierarchical-inheritance-in-python\/","title":{"rendered":"Hierarchical inheritance in Python"},"content":{"rendered":"<p style=\"text-align: center;\">Hierarchical inheritance in Python<\/p>\n<p>Hierarchical inheritance is when we are deriving more than one class from a parent class. Simply speaking, there is going to be one parent class, and more than one derived class. Let\u2019s have a look at an example, through which, we can simply understand the hierarchical inheritance &#8211;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3853 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/HIERARCHICAL-INHERITANCE.jpg\" alt=\"\" width=\"650\" height=\"293\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/HIERARCHICAL-INHERITANCE.jpg 650w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/HIERARCHICAL-INHERITANCE-300x135.jpg 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/p>\n<h2 style=\"text-align: center;\">Hierarchical inheritance in Python<\/h2>\n<p>As you can see in the above program, we have a Parent class, and there are two classes, which are derived from the parent class. This is the Hierarchical Inheritance, and you can use it as and when required. You can also refer to this diagram, which demonstrates hierarchical inheritance.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3854 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/HIERARCHICAL-INHERITANCE-1.jpg\" alt=\"\" width=\"346\" height=\"159\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/HIERARCHICAL-INHERITANCE-1.jpg 346w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/HIERARCHICAL-INHERITANCE-1-300x138.jpg 300w\" sizes=\"auto, (max-width: 346px) 100vw, 346px\" \/><\/p>\n<p>So, this was much about hierarchical inheritance. We can make use of this type of inheritance in our programs, as and when required. Remember that in the hierarchical inheritance, we are deriving more than one class, from a parent class.<\/p>\n<p>Let\u2019s now consider another type of inheritance, which is hybrid inheritance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hierarchical inheritance in Python Hierarchical inheritance is when we are deriving more than one class from a parent class. Simply speaking, there is going to be one parent class, and more than one derived class. Let\u2019s have a look at an example, through which, we can simply understand the hierarchical inheritance &#8211; Hierarchical inheritance in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[26,27],"class_list":{"0":"post-3850","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-python-tutorial","7":"tag-python","8":"tag-python-tutorial"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=3850"}],"version-history":[{"count":3,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3850\/revisions"}],"predecessor-version":[{"id":4233,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3850\/revisions\/4233"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=3850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=3850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=3850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}