Object-Oriented Programming
Learn to utilize one of the most popular programming paradigms - Object-Oriented Programming!
StartObject-Oriented Programming
Lesson 1 of 1
- 1In 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…
- 2When 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…
- 3When 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 overriding method …
- 5Let’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…
- 6Another 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…
- 7In 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…
- 8The 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…
- 9When 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…
- 10Encapsulation 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…
- 11Using 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…
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory