Learning Object-Oriented Programming by Gaston C. Hillar

Learning Object-Oriented Programming by Gaston C. Hillar

Author:Gaston C. Hillar
Language: eng
Format: epub, pdf
Publisher: Packt Publishing


Now, we have to make changes to the __init__ method because it worked with super().__init__ to invoke the __init__ method of its superclass. Now, the AngryCat class has two superclasses. It is necessary to call the __init__ method for both superclasses. In addition, we have to add all the arguments required to call the __init__ method for the added superclass: GameCharacter.

The following code shows the new version of the __init__ method for the GameCharacter class:

def __init__(self, nick_name, age, full_name, initial_score, x, y): ComicCharacter.__init__(self, nick_name) GameCharacter.__init__(self, full_name, initial_score, x, y) self.age = age



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.