0% found this document useful (0 votes)
18 views

Oops

This document discusses object-oriented programming concepts in Python including classes, objects, polymorphism, encapsulation, inheritance, and data abstraction. It defines each concept and provides examples. Classes create objects which consist of state represented by attributes and behavior represented by methods. Inheritance allows classes to inherit properties from parent classes in various ways like single, multilevel, hierarchical and multiple inheritance. Polymorphism allows the same function to work with different types of objects. Encapsulation wraps data and methods together and restricts access to variables. Data abstraction hides unnecessary implementation details from the user.

Uploaded by

maheswarilokku5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Oops

This document discusses object-oriented programming concepts in Python including classes, objects, polymorphism, encapsulation, inheritance, and data abstraction. It defines each concept and provides examples. Classes create objects which consist of state represented by attributes and behavior represented by methods. Inheritance allows classes to inherit properties from parent classes in various ways like single, multilevel, hierarchical and multiple inheritance. Polymorphism allows the same function to work with different types of objects. Encapsulation wraps data and methods together and restricts access to variables. Data abstraction hides unnecessary implementation details from the user.

Uploaded by

maheswarilokku5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

OOPS

CONCEPT IN
PYTHON
PRESENTING BY
S.SAI RAM
INTRODUCTION
• In Python, object-oriented Programming (OOPs) is a programming
paradigm that uses objects and classes in programming. It aims to
implement real-world entities like inheritance, polymorphisms,
encapsulation, etc. in the programming. The main concept of OOPs is
to bind the data and the functions that work on that together as a
single unit so that no other part of the code can access this data.
• OOPs Concepts in Python
Class
Objects
Polymorphism
Encapsulation
Inheritance
Data Abstraction

•Classes are created by keyword class.


•Attributes are the variables that belong to a class.
•Attributes are always public and can be accessed using the dot (.) operator. Eg.:
Myclass.Myattribute
An object consists of:
•State: It is represented by the attributes of an object.
It also reflects the properties of an object.
•Behavior: It is represented by the methods of an
object. It also reflects the response of an object to
other objects.
•Identity: It gives a unique name to an object and
enables one object to interact with other objects.
Python Inheritance
Inheritance is the capability of one class to derive or inherit the properties from another class. The class
that derives properties is called the derived class or child class and the class from which the properties
are being derived is called the base class or parent class. The benefits of inheritance are:
•It represents real-world relationships well.
•It provides the reusability of a code.
•It is transitive in nature.
Types of Inheritance
•Single Inheritance: Single-level inheritance enables a derived class to inherit characteristics from a
single-parent class.
•Multilevel Inheritance: Multi-level inheritance enables a derived class to inherit properties from an
immediate parent class which in turn inherits properties from his parent class.
•Hierarchical Inheritance: Hierarchical-level inheritance enables more than one derived class to
inherit properties from a parent class.
•Multiple Inheritance: Multiple-level inheritance enables one derived class to inherit properties from
more than one base class.
Python Polymorphism
Polymorphism simply means having many forms. For example, we need to determine if the given species of
birds fly or not, using polymorphism we can do this using a single function.
Polymorphism in Python
This code demonstrates the concept of inheritance and method overriding in Python classes.
Python Encapsulation
Encapsulation is one of the fundamental concepts in object-oriented programming (OOP). It describes the idea
of wrapping data and the methods that work on data within one unit. This puts restrictions on accessing
variables and methods directly and can prevent the accidental modification of data. To prevent accidental
change, an object’s variable can only be changed by an object’s method. Those types of variables are known as
private variables.
A class is an example of encapsulation as it encapsulates all the data that is member functions, variables, etc.

Data Abstraction
It hides unnecessary code details from the user. Also, when we do not want to give out sensitive parts of our code
implementation and this is where data abstraction came.
Data Abstraction in Python can be achieved by creating abstract classes.

PRESENTED BY SAI RAM

You might also like