Object-Oriented Programming (OOP) is a programming paradigm that uses objects and classes to design applications and computer programs. It provides a clear structure for the programs and makes code more maintainable and reusable.
Class
A blueprint for creating objects. It defines a set of attributes and methods that the created objects will have.
Object
An instance of a class. It's a self-contained component that contains properties and methods needed to make a certain type of data useful.
Method
A function that is defined inside a class and is associated with an object. It defines the behavior of the object.
Attribute
A variable that is defined inside a class and is associated with an object. It represents the state of the object.
Four Pillars of OOP
Encapsulation
Binding of data and functions that manipulate that data into a single unit called a class. It restricts direct access to some of an object's components, which is a way of preventing accidental modification of data.
Inheritance
Allows a class to inherit attributes and methods from another class. The class that inherits is called a child class, and the class being inherited from is called a parent class.
Polymorphism
Allows methods to do different things based on the object it is acting upon. The same method name can be used for different types.
Abstraction
Hiding the implementation details and showing only the necessary features of an object. In Python, we use abstract base classes (ABC) to achieve abstraction.