Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8648467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:19:13+00:00 2026-06-12T13:19:13+00:00

Hello i was searching about class inheritance in python and i saw that it

  • 0

Hello i was searching about class inheritance in python and i saw that it supports Multiple Inheritance as well but somehow seems problematic 😮
I ve found an example:

class ParentOne:
    def __init__(self):
        print "Parent One says: Hello my child!"
        self.i = 1

    def methodOne(self):
        print self.i

class ParentTwo:
    def __init__(self):
        print "Parent Two says: Hello my child"

class Child(ParentOne, ParentTwo):
    def __init__(self):
        print "Child Says: hello"
A=Child()

Output

Child Says: hello

So when child inherits ParentOne and ParentTwo why arent those classes initialised? Should we manually initialize them within the inherit class Child? Whats the correct example so we can see all messages printed using only inheritage?

In fact, it is slightly more complex than that; the method resolution
order changes dynamically to support cooperative calls to super().
This approach is known in some other multiple-inheritance languages
as call-next-method and is more powerful than the super call found in
single-inheritance languages.

How can it be more powerful when it need to be initialized manually?
Sorry for all these questions.
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:19:14+00:00Added an answer on June 12, 2026 at 1:19 pm

    This is what super is for:

    class ParentOne():
        def __init__(self):
            super().__init__()        
            print("Parent One says: Hello my child!")
            self.i = 1
    
        def methodOne(self):
            print(self.i)
    
    class ParentTwo():
        def __init__(self):
            super().__init__() 
            print("Parent Two says: Hello my child")
    
    class Child(ParentOne, ParentTwo):
        def __init__(self):
            super().__init__()
            print("Child Says: hello")
    
    A=Child()
    

    prints

    Parent Two says: Hello my child
    Parent One says: Hello my child!
    Child Says: hello
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I am searching for a graph control that will allow me to make
I've been searching everywhere and there seems to be very little about Zen Cart...
hello I am searching for all instances of tags with the EXACT class hello
Hello guys , I have spent about twenty minutes searching in vain for my
Hello I've been searching for a web hosting site that enables php frameworks, e.g.
hello i have been searching for some php code that is something like element.innerHTML
Possible Duplicate: Subclassing UIView to draw in Quartz Hello i am searching good example
hello I am making web page searching program with windows batch file before searching
Hello! I've been programming for a long time but just started developing for android,
Hello I have like this 2 tables class User public int UserId{get;set;} { ....

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.