Welcome to Learn OOPs, a simple and practical repository to understand and practice the core concepts of Object-Oriented Programming (OOP) using Python.
This project helps you learn by doing — with beginner-friendly code examples and exercises.
The goal of this repository is to:
- Understand the four pillars of OOP:
🔹 Encapsulation
🔹 Inheritance
🔹 Polymorphism
🔹 Abstraction - Write clean, modular, and reusable Python code.
- Build a strong foundation for real-world software development and interview preparation.
learn-oops/ ├── oops/ │ └── class or objects/ │ ├── p0.py # Example of inheritance, encapsulation, ├── requirements.txt └── README.md
git clone https://github.com/SuyXcode/learn-oops.git
cd learn-oops###2️⃣ Create and activate a virtual environment
python -m venv .venv
# Activate it:
# On Windows:
.venv\\Scripts\\activate
# On Mac/Linux:
source .venv/bin/activate
###3️⃣ Install dependencies
pip install -r requirements.txt
| Concept | Example File | Description |
|---|---|---|
| Encapsulation | bank.py |
Using protected attributes (_balance) and property methods |
| Inheritance | bank.py |
SavingsAccount and CheckingAccount inherit from BankAccount |
| Polymorphism | bank.py, shapes.py |
Functions that handle different object types with the same interface |
| Abstraction | shapes.py |
Abstract base class Shape defines a common blueprint |
| Composition | (Upcoming) | Combine objects for more complex relationships |
- 🐍 Python 3.11+
- 🧪 PyTest for testing
- 🧰 Git & GitHub for version control and collaboration
- 🧑💻 VS Code (recommended for running and debugging)
This repositories is open-source under the MIT License.
Feel free to fork, modify, and learn from it!
Suyash Singh
💡 "Turning Dream Event into Reality!"
📧 Email: suyxcode@gmail.com
🔗 GitHub • Medium • LinkedIn
✔ Add more real-world examples (Library Management, Student Class, E-commerce System).
✔ Implement interfaces, class methods, and static methods.
✔ Try OOP with Flask/Django to see how real frameworks use these concepts.
✔ Contribute your examples via pull requests!
⭐ If you find this repository helpful, give it a star on GitHub!