OOP in Python Part_02

Difference between POP & OOP
Principles of Object Oriented Programming
OOPs is based on the concept of objects rather than actions, and data rather than logic. In order for a programming language to be object oriented,it should have mechanism to enable working with class & objects as well as the implementation . Usage of the fundamental object oriented principles and concepts namely Inheritance, Abstraction,Encapsulation and Polymorphism.
Abstraction
Abstraction allows us to hide the details and expose only the essential features of a concept or obect . For example, a person driving a car . He knows that on pressing a horn , sounds emitted . But he has no idea about how the sound is actually generated on pressing the horn . The main focus of abstraction is to hide unnecessary details from the users. It is one of the important concepts of OOPs.
Encapsulation
Encapsulation is an attribute of an object & it contains all data which is hidden. That hidden data can be restricted to the members of that class. This property hides unnecessary details and makes it easier to manage the program structure .It has two divided into two part.
Data hiding
Bundling of data and methods together and it work with one unit.
Here levels are public , protected, private, internal and protected internal.
In other words ,Encapsulation in Python describes the concept of bundling data and methods within a single unit. So, for example, when you create a class, it means you are implementing encapsulation. A class is an example of encapsulation as it binds all the data members (instance variables) and methods into a single unit.
Inheritance
A class is based on another class and uses data & implementation of other class .In inheritance, the child class acquires all the data members, properties, and functions from the parent class. Inheritance aslo called generalization , allows us to capture a hierachal relationship between classes and objects. For instance, a 'Fruit' is a generalization of orange . Inheritance is very useful from a code reuse perspective.
Another way , The process of inheriting the properties of the parent class into a child class is called inheritance. The existing class is called a base class or parent class and the new class is called a subclass or child class or derived class.
Polymorphism
Polymorphism means many forms .It is a thing or action is present different forms or ways. In simple words, polymorphism allows us to perform the same action in many different ways.For example, Ayisha acts as an employee when she is at the office. However, when she is at home, she acts like a wife. Also, she represents herself differently in different places. Therefore, the same person takes different forms as per the situation. In polymorphism, a method can process objects differently depending on the class type or data type.
Subscribe to my newsletter
Read articles from Mohammad Ishak directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Mohammad Ishak
Mohammad Ishak
I am a passionate Back End Web Developer . I am also passionate about learning and sharing my knowledge with others as publicly as possible. My passion is solve real world problems with simple way . I always focus on my goals . I am also a good learner and friendly person . Always try perfect quality work in my every steps of my work. Research & development, community leading is the top most noticeable skill inside me. I strongly believe in the power of the Internet,and has an intense desire to learn how to improve the webs absolute core functionality, and to also be involved in its future & development. I have also a very good understand of the very latest tricks of Programming. I am an innovative & qualityful skiller person with a deep passion . I always enjoy my work very much . 🤠 Key Skills: 🔹HTML,CSS. 🔹 Python & Django Basic, 🔹 Mysql(basic) ,Understanding on OOP . 🔹 Git & Github 🤠 Currently Learning - 🔹More Deep Dive into Django 🔹Javascript 🔹 OOP in Python 🔹Mongodb 🔹Django Rest framework 🤠 Other skills: 🔹Comfortable using Linux as well as Windows. 🔹 Comfortable to install Open-source software. 🔹Research, Analytical, and Decision-Making Skills. 🤠 Extra-Skills : ▪ Ability to work in a team ▪ Ability to work under Extreme presure. ▪ Excellent Communication Skills. ▪ Ability to Multitask. ▪ Adaptability. ▪ Project Management skills ▪ Thinking outside of the box ▪ Hard work ▪ Culture Awareness ▪ Self-development Skill