OOP Concepts

Major principles of object-oriented programming systems are given below.

  • Class

  • Object

  • Method

  • Inheritance

  • Polymorphism

  • Data Abstraction

  • Encapsulation

Metaclass

https://www.edureka.co/blog/python-metaclasses/

Class

The class can be defined as a collection of objects. It is a logical entity that has some specific attributes and methods. It generally contains an attribute and method

Class

A class in Python is a category or set of different elements grouped together that share one or more similarities with one another, but yet distinct from other classes via type, quality, and kind. In technical terminology, we can define a class in Python as being a blueprint for individual objects with the same or exact behavior.

Object

An object in Python is one instance of a class and it can be programmed to perform the functions that have been defined in the class.

Self

The "self" in a keyword in Python is used for all the instances in a class. By using the self keyword, one can easily access all the instances defined within a class, including its methods and attributes

init

__init__ is one of the reserved methods in Python. In object-oriented programming, it is known as a constructor. The __init__ method can be called when an object is created from the class, and access is required to initialize the attributes of the class.

Example of class

When designing the NFS game using python, one of the classes will be a car. Every car will have different properties like color, shape, gear, max speed, etc.

Last updated

Was this helpful?