/Python_OOP

Python Object Oriented Programing

Primary LanguagePython

Python_OOP

Object-oriented Programming, or OOP for short, is a programming paradigm which provides a means of structuring programs so that properties and behaviors are bundled into individual objects.

With this learning path you’ll get a solid grasp of the fundamentals of OOP in Python and how you can use this programming paradigm to make your programs easier to write and maintain.

You learn more from failure than from success

OOP in Python

Python is a multi-paradigm programming language. It supports different programming approaches. An object-oriented paradigm is to design the program using classes and objects. The object is related to real-word entities such as book, house, pencil, etc. The oops concept focuses on writing the reusable code. It is a widespread technique to solve the problem by creating objects. One of the popular approaches to solve a programming problem is by creating objects. This is known as Object-Oriented Programming (OOP).

OOP And python Possible?

It is Possible


Properties of Object Oriented Programing

OOP has 7 main objectives they are

  1. Class
  2. Object
  3. Method
  4. Inheritance
  5. Polymorphism
  6. Data Abstraction
  7. Encapsulation

Class

The class can be defined as a collection of objects. It is a logical entity that has some specific attributes and methods. For example: if you have an employee class, then it should contain an attribute and method, i.e. an email id, name, age, salary, etc. class is like a blueprint for making a things when we talk in reallife sitautions a class is like a blueprint of a car and diff models can be made from it the attributes like noofwheel,petrol,milage can be considered as the attribues as different methods in a class.

You learn more from failure than from success

Object

OOP is all about objects making objects,manipulating them,recreating them destroying them etc. Class is the blueprint which makes a object all the operations can be acquired from the class to use a class we need to create a object of that class inorder to use the attributes of class

It’s Not Whether You Get Knocked Down, It’s Whether You Get Up.

Method

The method is a function that is associated with an object. In Python, a method is not unique to class instances. Any object type can have methods. like Example for a car we can have a methods like addpetrol,changewheels,changecolor. methods are used to manipulate the object.

People Who Are Crazy Enough To Think They Can Change The World, Are The Ones Who Do.

Encapsulation

Using OOP in Python, we can restrict access to methods and variables. This prevents data from direct modification which is called encapsulation. In Python, we denote private attributes using underscore as the prefix i.e single _ or double __ Encapsulation is achieved when each object keeps its state private, inside a class. Other objects don’t have direct access to this state. Instead, they can only call a list of public functions — called methods.

Knowing Is Not Enough; We Must Apply. Wishing Is Not Enough; We Must Do.

Inheritance

Inheritance is a way of creating a new class for using details of an existing class without modifying it. The newly formed class is a derived class (or child class). Similarly, the existing class is a base class (or parent class). It means that you create a (child) class by deriving from another (parent) class. This way, we form a hierarchy. The child class reuses all fields and methods of the parent class (common part) and can implement its own (unique part).

Creativity Is Intelligence Having Fun

Abstraction

In object-oriented design, programs are often extremely large. And separate objects communicate with each other a lot. So maintaining a large codebase like this for years — with changes along the way — is difficult. Abstraction is a concept aiming to ease this problem. Applying abstraction means that each object should only expose a high-level mechanism for using it.

Everybody has goals, aspirations or whatever, and everybody has been at a point in their life where nobody believed in them.

Polymorphism

Say we have a parent class and a few child classes which inherit from it. Sometimes we want to use a collection — for example a list — which contains a mix of all these classes. Or we have a method implemented for the parent class — but we’d like to use it for the children, too. This can be solved by using polymorphism. Simply put, polymorphism gives a way to use a class exactly like its parent so there’s no confusion with mixing types. But each child class keeps its own methods as they are.


Success is my only option, failure’s not.


# Made By:

GuND0Wn151 , India