Your technical depth starts here.
Module 1 – Overview · Classes and Objects
Module 1 – Overview
Overview
- Object-Oriented Programming (OOP) is a programming paradigm based on objects that contain data and methods.
- A class is a blueprint; an object is an instance of that blueprint.
- OOP helps organize software in a modular, reusable, and maintainable way.
- OOP is especially useful for modeling real-world enties like Car, Student, BankAccount, etc.
- The main OOP principles are encapsulation, inheritance, polymorphism, and abstraction.
- OOP improves code reuse through inheritance and composition.
- OOP improves maintainability because code is split into smaller units.
- OOP improves scalability by building large systems from reusable components.
- OOP also supports flexibility by allowing extension without rewriting everything.
- In exam questions, OOP is often tested through definitions, differences, and code behavior.
Classes and Objects
- A class defines attributes and methods.
- A class is not a real entity by itself; it becomes useful when objects are created.
- An object is a concrete instance of a class.
- Attributes represent the state of an object.
- Methods represent the behavior of an object.
- One class can create many objects.
- Each object has its own independent state.
- In C++, objects are created from classes using normal declaration.
- In Java, objects are typically created using the new keyword.
- Real-world example: Car class with brand, model, start(), drive().
Encapsulation
- Encapsulation means bundling data and methods into a single unit.
- Encapsulation is also called data hiding.
- Encapsulation protects data from direct outside access.
- Encapsulation improves security and data integrity.
- In exam terms, encapsulation usually means using private data members and public methods.
- Encapsulation allows controlled access to internal state.
- Getters and setters are common encapsulation tools.
- Private members cannot be accessed directly from outside the class.
- Encapsulation makes code easier to debug and maintain.
- Encapsulation reduces accidental changes to object data.
