diff --git a/_posts/2020-04-16-oops.md b/_posts/2020-04-16-oops.md index d306523..bc467ff 100644 --- a/_posts/2020-04-16-oops.md +++ b/_posts/2020-04-16-oops.md @@ -424,12 +424,12 @@ Health from electric Pokemon: 50 super() is also used with the methods. Whenever a parent class and the immediate child class have any methods with the same name, we use super() to access the methods from the parent class inside the child class. ```python class Pokemon: # defining the parent class - def display(self): # defining diplay method in the parent class + def display(self): # defining display method in the parent class print("I am from the Pokemon Kanto Originals") class Johto(Pokemon): # defining the child class - # defining diplay method in the parent class + # defining display method in the parent class def display(self): super().display() print("I am from the Johto Region Pokemon") @@ -647,10 +647,10 @@ square = Square(20) In the example above, you can see that an instance of Shape can be created even though an object from this class cannot stand on its own. Square class, which is the child class of Shape, actually implements the methods, area() and perimeter(), of the Shape class. Shape class should provide a blueprint for its child classes to implement methods in it. To prevent the user from making a Shape class object, we use abstract base classes. To define an abstract base class, we use the abc module. The abstract base class is inherited from the built-in ABC class. We have to use the decorator @abstractmethod above the method that we want to declare as an abstract method. -Now, we will learn about the relationship between objects themseleves. +Now, we will learn about the relationship between objects themselves. ### Aggregation and Composition -Classes have three different types of relationships. These includes 'is-a', 'has-a' and 'part-of' relatiobships. We already revisited the 'is-a' relationship in form of inheritance. +Classes have three different types of relationships. These includes 'is-a', 'has-a' and 'part-of' relationships. We already revisited the 'is-a' relationship in form of inheritance. We define the 'Part-Of' relationship now: In this relationship, one class object is a component of another class object. Given two classes, class A and class B, they are in a part-of relation if a class A object is a part of class B object, or vice-versa.