Python 3-OOPS

Python Object Oriented Programming

Python is a multi-paradigm programming language. Meaning, it supports different programming approach. One of the popular approaches to solve a programming problem is by creating objects. This is known as Object Oriented Programming (OOP).

An object has two characteristics:

  • Attributes
  • Behavior

Let’s take an example,

Peacock is an object

  • Name, age, color are attributes
  • Singing, Dancing are behavior

The main advantage of OOP in Python focuses on reusable of the code. This concept is also known as DRY (Don’t Repeat Yourself).

In Python, the concept of OOP follows some basic principles:

  • Inheritance – A process of reusing the details in new class without modifying the existing class.
  • Encapsulation – To hide the private details of a class from other object
  • Polymorphism – A concept of using common operation in different ways for different data input.