Object Oriented Programming Using Python: BY:-Nisreen Basher Alshagi
Object Oriented Programming Using Python: BY:-Nisreen Basher Alshagi
Using Python
Introduction
Different
What are
Object
Introduction
“objects” to represents data and methods. It is
Different
Object
What are
Introduction
What are
Different
Object
What are Classes and Objects?
Class is a template of object
Object is a instance of a class
Example:
Introduction
Different
What are
Object
Creating an Object and Class in python:
Introduction
Different
What are
Object
Object-Oriented Programming methodologies:
❑ Encapsulation
• is one of the fundamentals of OOP.
• Simplifies and makes it easy to understand to use
an object without knowing the internals.
Encapsulation
Introduction
• Encapsulation provides us the mechanism of
Different
What are
Object
restricting the access to some of the object’s
components, this means that the internal
representation of an object can’t be seen from
outside of the object definition.
• Access to this data is typically achieved through
special methods: Getters and Setters.
Abstraction
Creating an Encapsulation in python:
Encapsulation
Object
What are
Different
Introduction
Abstraction
This property allows us to hide the details and
expose only the essential features of a concept
or object.
Example:
Encapsulation
Introduction
Inheritance
Abstraction
Different
What are
Object
CLASS CAR:
def get_speed(self):
return self.speed
Inheritance
in Programming , It generally means “inheriting or
transfer of characteristics from parent to child
class without any modification”. The new class is
Polymorphism
Abstraction
Inheritance
Encapsulation
Introduction
which it is derived is called a parent/base class.
Different
What are
Object
v
Single Inheritance
Abstraction
Inheritance
Encapsulation
Introduction
Different
What are
Object
v
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.
Polymorphism
Abstraction
Inheritance
Encapsulation
Introduction
Different
What are
Object
v
Polymorphism
v
Creating an Multilevel Inheritance in python:
Inheritance
Abstraction
Encapsulation
Object
What are
Different
Introduction
Hierarchical Inheritance
Abstraction
Inheritance
Encapsulation
Introduction
Different
What are
Object
v
Polymorphism
v
Inheritance
Creating an Hierarchical Inheritance in python:
Abstraction
Encapsulation
Object
What are
Different
Introduction
Multiple Inheritance
Abstraction
Inheritance
Encapsulation
Introduction
Different
What are
Object
v
Polymorphism
Creating an Multiple Inheritance in python:
v
Inheritance
Abstraction
Encapsulation
Object
What are
Different
Introduction
Polymorphism
It is one such OOP methodology where one task can
be performed in several different ways
overloading
Polymorphism
Polymorphism
Abstraction
Inheritance
with different argument lists.
Encapsulation
Introduction
Different
What are
Object
v
overriding
is a feature that allows us to use a function in the child
class that is already present in its parent class
Creating an overloading function in python:
overloading
Polymorphism
v
Inheritance
Abstraction
Encapsulation
Object
What are
Different
Introduction
ating an overriding function in python:
overriding
Polymorphism
v
Inheritance
Abstraction
Encapsulation
Object
What are
Different
Introduction