Object-Oriented Programming
Lesson 1 of 1
  1. 1
    In programming, most languages offer various features that give us different ways to tackle technical problems. With so many different languages out there, with their own unique set of features, it…
  2. 2
    When we hear the word “inheritance”, code may not be the first thing that springs to mind; we’re probably more likely to think of inheriting genetic traits, like the eye color from a mother or dimp…
  3. 3
    When implementing inheritance, a child class may want to change the behavior of a method from its parent class. In Python, all we have to do is override a method definition. An overridden method …
  4. 4
    When overriding methods we sometimes want to still access the behavior of the parent method. In order to do that we need a way to call the method of the parent class. Python gives us a way to do th…
  5. 5
    Let’s now look at a feature allowed by Python called multiple inheritance. As you may have guessed from the name, this is when a subclass inherits from more than one superclass. One form of multi…
  6. 6
    Another form of multiple inhertance involves a subclass that inherits directly from two classes and can use the attributes and methods of both. class Animal: def init(self, name): self.n…
  7. 7
    In computer programming, polymorphism is the ability to apply an identical operation onto different types of objects. This can be useful when an object type may not be known at the program runtim…
  8. 8
    The code below shows that when working with different object types like, int, str or list, the + operator performs different functions. This is known as operator overloading and is another form o…
  9. 9
    When a program starts to get big, classes might start to share functionality or we may lose sight of the purpose of a class’s inheritance structure. In order to alleviate issues like this, we can u…
  10. 10
    Encapsulation is the process of making methods and data hidden inside the object they relate to. Languages accomplish this with what are called access modifiers like: - Public - Protected - Priv…
  11. 11
    Using getter, setter, and deleter functions are one way to implement encapsulation within Python where the state of class attributes can be handled within the class. These functions are usefu…
  12. 12
    Congratulations! You’ve completed the object-oriented programming with Python lesson. Let’s do a quick recap of what you learned. We discussed the four pillars of object-oriented programming as th…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo