Learn Python Quickly: A Complete Beginner’s Guide to Learning Python, Even If You’re New to Programming (Crash Course With Hands-On Project Book 1) by Code Quickly

Learn Python Quickly: A Complete Beginner’s Guide to Learning Python, Even If You’re New to Programming (Crash Course With Hands-On Project Book 1) by Code Quickly

Author:Code Quickly [Quickly, Code]
Language: eng
Format: azw3
Published: 2020-03-21T16:00:00+00:00


print(issubclass(Developer, Employee))

9.2 - Multiple Inheritance

It’s possible to inherit from multiple classes. In order to do so, you need to specify the parent classes in the class creation statement and specify what attributes you want to inherit when you initialize the child class. Remember that, by default, the child class will have access to the methods of both parent classes.

Let’s say we wanted to create a new Equipment class that will keep track of what equipment the employees are using and who that piece of equipment belongs to. After we create the class, we can update our Developer class to inherit from the new Equipment class. We’ll then just create a couple Equipment objects and pass them in as arguments to the creation of our employee objects.



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.