OOPs in python

OOPs in python

What is OOP's?

OOPs stands for Object-Oriented Programming Language. Object Oriented Programming (OOP) is a programming paradigm that uses classes and objects. It's utilized to break down a software program into reusable code blueprints (called classes) that may be used to build specific instances of things. In this blog I will discuss about Oops in Python specifically.


A Python class is similar to a blueprint for constructing a new object. An object is something you want to do to manipulate or edit while working through the code. Every time a class object is instantiated, which is when we declare a variable, a new object is built from scratch. Class objects can be used many times if needed.


This are different type of bike, but all are called bike only, Similarly Class is collection of similar objects. 


class <Class Name>:




A class is instantiated as an object (instance). Only the object's description is defined when class is defined.

Syntax: <object-name> = <class-name>(<arguments>)     



As we can use an existing class to construct a new class rather than starting from scratch, inheritance allows us to reuse code. 


The child class inherits the attributes of the parent class and has access to all of the data objects and functions declared in the parent class. A child class can also provide its own implementation for the parent class's functionalities.


A derived class can inherit a base class in Python by simply putting the base class name in brackets after the derived class name.


Class of BaseClass:

#Body of BaseClass

Class DerviedClass (BaseClass):

#Body of DerviedClass


Encapsulation is the process of enclosing all critical information within an object and only revealing a selected information of it to the outside world. Inside a class, encapsulation hides the internal software code implementation as well as the internal data of the objects. Encapsulation includes identifying some fields as private while others are made public.


Methods and properties that are only accessible from other methods in the same class are known as the private/internal interface. Security is improved via encapsulation. Private attributes and methods can be defined to prevent access from outside the class. Public methods and properties are used to gather information about data in an object and to access or alter data.


Polymorphism comes from the Greek words poly (many) and morphism (morphism) (forms). It indicates that a function with the same name can be used for various types. This improves and simplifies programming. Polymorphism refers to the creation of items that have similar behavior. Objects can modify shared parent behaviors with specific child behaviors through inheritance.



  • Avani Popat
  • Mar, 10 2022

Add New Comments

Please login in order to make a comment.

Recent Comments

Be the first to start engaging with the bis blog.