Object-Oriented Programming (OOP) is a way of writing code where we organize it into objects — just like real-world things (car, user, product).
Each object has:
* Properties (data)
* Methods (functions)
It helps to structure big programs, reuse code, and keep everything organized and manageable.
🔹 Main Concepts of OOP (4 Pillars):
1. Encapsulation – Group data and functions together
* Keep related things inside one object/class
* Hide internal details from outside
✅ Example:

2. Inheritance – Reuse code from other classes
* One class can inherit properties and methods from another
✅ Example:

3. Polymorphism – Same method name, different behavior
* One method works differently based on the object/class
✅ Example:

4. Abstraction – Show only what is needed
* Hide complex parts, show only necessary details
* Keeps code clean and secure
✅ Example: You may call `user.login()`, but you don’t need to know how login works inside.
🔹 Why Use OOP in JavaScript?
* Organizes code better
* Reuse code using classes
* Makes code easier to test and debug
* Great for real-world applications like e-commerce, chat apps, etc.
🔹 Real-Life Analogy:
Think of a Car as an object:
* Properties → color, brand, model
* Methods → start(), drive(), stop()
🔹 ES6 Class Syntax Example:

Object-Oriented Programming (OOP) হলো প্রোগ্রাম লেখার একটি পদ্ধতি, যেখানে কোডগুলোকে অবজেক্ট (object) আকারে গঠিত করা হয়।
প্রতিটি অবজেক্টের দুটি জিনিস থাকে:
* প্রপার্টি (property) → ডেটা বা বৈশিষ্ট্য
* মেথড (method) → ফাংশন বা কাজ করার ক্ষমতা
OOP ব্যবহারে বড় বড় প্রজেক্ট গুছিয়ে লেখা যায়, কোড বারবার ব্যবহার করা যায়, ও ভুল খুঁজে বের করাও সহজ হয়।
🔹 OOP-এর ৪টি মূল ভিত্তি (4 Pillars):
# ১. Encapsulation (সংবরণ/আবরণ)
* ডেটা এবং ফাংশনকে একসাথে একটি অবজেক্ট বা ক্লাসে গুচিয়ে রাখা
* বাইরের অংশ থেকে কিছু অংশ লুকিয়ে রাখা যায়
# ২. Inheritance (উত্তরাধিকার)
* একটি ক্লাস অন্য একটি ক্লাসের প্রপার্টি এবং মেথড ব্যবহার করতে পারে
* কোড পুনরায় ব্যবহার করা যায়
# ৩. Polymorphism (বহুরুপিতা)
* একই নামের মেথড, কিন্তু বিভিন্ন ক্লাসে ভিন্নভাবে কাজ করে
# ৪. Abstraction (নির্যাস/সারাংশ উপস্থাপন)
* জটিল বিষয়গুলো লুকিয়ে রেখে শুধু প্রয়োজনীয় অংশ দেখানো
* কোডকে পরিষ্কার ও সিকিউর রাখা যায়
🔹 JavaScript-এ OOP কেন ব্যবহার করবেন?
* বড় প্রজেক্ট গুছিয়ে তৈরি করা যায়
* কোড বারবার ব্যবহার করা যায় (reuse)
* টেস্ট ও ডিবাগ করা সহজ হয়
* E-commerce, Chat App, Inventory System এর মতো বাস্তব প্রজেক্টে উপকারী
🔹 বাস্তব জীবনের উদাহরণ:
Car (গাড়ি) → একটি অবজেক্ট
* প্রপার্টি → color, brand, model
* মেথড → start(), drive(), stop()