Skip to content

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

Notifications You must be signed in to change notification settings

ahmed-devolper6/Python3-Opp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Python3-Opp

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

Main Concepts of Object-Oriented Programming (OOPs)

Class:

A class is a collection of objects. A class contains the blueprints or the prototype from which the objects are being created. It is a logical entity that contains some attributes and methods. 

Objects:

The object is an entity that has a state and behavior associated with it. It may be any real-world object like a mouse, keyboard, chair, table, pen, etc. Integers, strings, floating-point numbers, even arrays, and dictionaries,
are all objects. More specifically,
any single integer or any single string is an object. The number 12 is an object, the string “Hello, world” is an object, a list is an object that can hold other objects, and so on. You’ve been using objects all along and may not even realize it.

self :

- 1 - Class methods must have an extra first parameter in the method definition. We do not give a value for this parameter when we call the method, Python provides it

- 2- If we have a method that takes no arguments, then we still have to have one argument.

- 3- This is similar to this pointer in C++ and this reference in Java.

Inheritance :

Inheritance is the capability of one class to derive or inherit the properties from another class.

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.

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.

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.

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages