Inheritance and Composition: A Python OOP Guide (Overview)
In this course, you’ll explore inheritance and composition in Python. Inheritance and composition are two important concepts in object oriented programming that model the relationship between two classes. They are the building blocks of object oriented design, and they help programmers to write reusable code.
By the end of this course, you’ll know how to:
- Use inheritance in Python
- Model class hierarchies using inheritance
- Use multiple inheritance in Python and understand its drawbacks
- Use composition to create complex objects
- Reuse existing code by applying composition
- Change application behavior at run-time through composition
00:00 Hi! My name is Austin Cepalia with realpython.com, and I welcome you to the next stepping stone on your path to learning object-oriented programming in Python 3. This course covers inheritance and composition, two major ideas that will allow you to write better object-oriented Python code.
00:21 By the end of this course, you will know how to create classes that inherit from one another, design basic class hierarchies with UML diagrams, use interfaces and abstract classes, use multiple inheritance and understand its drawbacks, build complex classes with composition, and finally, change run-time behavior using composition.
01:00 That means that you should have already gone through my first Real Python course, Intro to Object-Oriented Programming in Python. In that course, I introduce you to the fundamental ideas behind OOP, and I demystify buzzwords like class, object, instance, attribute, and method. If those words sound foreign to you, I’d recommend taking another pass through that course before continuing.
01:37 And finally, just a little bit of advice. This is a long course, and unless you already understand these concepts and you’re watching as a refresher, then you really shouldn’t rush through this in one sitting.
02:14 That’s one reason why every video course and article on realpython.com is organized into sections. Watch the videos, code along with me, and solidify your understanding of the material by seeing how small modifications to the code you write changes the output of the program.
Become a Member to join the conversation.