Key concepts

OOPs is a vast topic that needs to be covered at the intermediate level. In case of Python programming, however, we will cover some key concepts in this chapter.

  • Class: Class is considered as a blueprint for object creation. It can be understood as a factory to produce objects. It provides a template for creating an object and specifying its behavior through means of methods and state through means of variable instance name.
  • Objects: They can be considered as an instance of a class. An object can have state and behavior or attributes. The objects basically bundles a set of related states and behaviors, for example, a dog has state (name) and behavior (barking).
  • Inheritance: Inheritance is a feature supported by many programming languages, it can be correlated in real life as properties passed on by parents to their children. In object-oriented programming, the child class can inherit many properties from the parent class. Here, we mean that the child class can use an existing method or behavior, which the parent class has defined and use them accordingly in their class. Inheritance can be a single inheritance or multiple inheritance. Single inheritance, as the name suggests, refers to only one parent, while multiple inheritance refers to inheriting the property from multiple parents.
  • Polymorphism: Well, this literally means something, which has many forms. In OOPs, an object can have many forms through means of different attributes. To simplify, in our case, we can understand it by methods with the same name but having different outputs.
  • Abstraction: Here, we hide the necessary details and are only interested in showing the relevant details to the other intended user. Here, by other intended user we mean another software application, or another class, or other client who will be the end users of the program.
  • Encapsulation: This refers to hiding the necessary methods and their relevant details from the outside world. A class can be treated as a best example, which provides encapsulation to the methods and relevant instances.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.138.178