Using multiple inheritance

A class with more than one superclass inherits its attributes from all its superclasses. Such a class uses multiple inheritance.

REMEMBER To write a subclass that uses multiple inheritance, type the names of more than one superclass in a class statement. For example:

class SubClassName(SuperClass1, SuperClass2):

And here's how you would create a "mutt" type of dog (this dog is probably easier to create as a Python class than in real life):

class Heinz57Dog(Chihuahua, Greyhound, Mastiff, Dalmatian):

Was this article helpful?

0 0

Post a comment