{"id":3840,"date":"2022-12-05T06:51:18","date_gmt":"2022-12-05T06:51:18","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=3840"},"modified":"2022-12-05T06:51:20","modified_gmt":"2022-12-05T06:51:20","slug":"multilevel-inheritance-in-python","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/multilevel-inheritance-in-python\/","title":{"rendered":"Multilevel inheritance in Python"},"content":{"rendered":"<p style=\"text-align: center;\">Multilevel inheritance in Python<\/p>\n<p>In the case of multilevel inheritance, a child class inherits from the parent class, and then there is another class, which inherits from the child class. Simply speaking, there are levels of inheritance. This is like there is some grandfather, and the father inherits some features from the grandfather, and then there is a child, which inherits some features from the father. Let\u2019s have a look at some examples so that we can understand better about multilevel inheritance.<\/p>\n<h2 style=\"text-align: center;\">Multilevel Inheritance in python<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3841 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/MULTILEVEL-INHERITANCE.jpg\" alt=\"\" width=\"664\" height=\"286\" srcset=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/MULTILEVEL-INHERITANCE.jpg 664w, https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/MULTILEVEL-INHERITANCE-300x129.jpg 300w\" sizes=\"auto, (max-width: 664px) 100vw, 664px\" \/><\/p>\n<p>As you can see, in the above program, we have created a class named GrandParent, and there is the class Father, which inherits from the GrandParent class. Again, there is the class Child, which inherits from the Father class. So here, there are some multiple levels of inheritance, and you can see that the Father class object can access the method from the GrandParent class, and also the Child class object can also access the method from the GrandParent class, and this is due to the inheritance.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3842 size-full\" src=\"https:\/\/gyanipandit.com\/programming\/wp-content\/uploads\/2022\/11\/MULTILEVEL-INHERITANCE-1.jpg\" alt=\"\" width=\"266\" height=\"221\" \/><\/p>\n<p>Now, that we have an idea of what is multilevel inheritance, Let\u2019s now move ahead, to see multiple inheritances. You can also refer to the diagram, which gives a clearer idea about the multilevel inheritance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Multilevel inheritance in Python In the case of multilevel inheritance, a child class inherits from the parent class, and then there is another class, which inherits from the child class. Simply speaking, there are levels of inheritance. This is like there is some grandfather, and the father inherits some features from the grandfather, and then [&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-3840","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\/3840","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=3840"}],"version-history":[{"count":2,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3840\/revisions"}],"predecessor-version":[{"id":4231,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3840\/revisions\/4231"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=3840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=3840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=3840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}