(OOP) – Complete Study Notes
Introduction
Object-Oriented Programming (OOP) is a programming paradigm that organizes software
design around data and objects rather than only functions and procedures. In Python, OOP
allows developers to represent real-world entities such as students, vehicles, or bank
accounts as objects within programs.
Python provides strong support for object-oriented programming which helps
programmers build structured and scalable applications. By using objects and classes,
complex software systems can be broken into manageable components.
OOP is widely used in modern software development because it promotes modular
programming, improves code readability, and encourages reuse of existing code.
Definition
Object-Oriented Programming is a programming approach where programs are structured
using objects and classes. A class acts as a blueprint, while objects are instances created
from that blueprint.
In Python, a class defines the structure and behavior that its objects will possess. This
includes attributes for storing data and methods for performing operations.
OOP allows developers to combine data and functions into a single logical unit, which helps
organize programs more efficiently.
Key Principles of OOP
The four fundamental principles of object-oriented programming are encapsulation,
inheritance, polymorphism, and abstraction.
Encapsulation involves combining data and methods inside a class while restricting direct
access to internal data.
Inheritance allows new classes to reuse features from existing classes, reducing duplication
in programs.
Polymorphism allows the same function or method name to perform different tasks
depending on the object being used.
Abstraction hides complex internal implementation details and presents only essential
features to users.