
Object-Oriented Programming (OOP) is a programming approach where software is designed using objects , which combine data (attributes) and behavior (methods) .
Object-Oriented Programming (OOP) is a programming approach where software is designed using objects, which combine data (attributes) and behavior (methods).
👉 Simple idea: Programs are built by modeling real-world entities like Car, Student, BankAccount as objects.
Example:
Class: Student
Attributes: name, rollNo
Methods: study(), attendClass()
Example:
Student s1 = new Student();
| Component | Meaning |
|---|---|
| Attributes | Data (variables) |
| Methods | Functions (behavior) |
Example: Using a mobile phone without knowing internal circuits
Example:
private balance;
public deposit();
Example:
Animal → Dog
Benefit: Code reuse
Types:
Objects communicate by calling each other's methods
Method call is resolved at runtime
| Type | Meaning |
|---|---|
| Association | General relation |
| Aggregation | Weak ownership |
| Composition | Strong ownership |
👉 Bank System
Class:
BankAccount
- balance
+ deposit()
+ withdraw()
Object:
acc1.deposit(1000)
| Feature | OOP | Procedural |
|---|---|---|
| Focus | Objects | Functions |
| Data Security | High | Low |
| Reusability | High | Limited |
OOP = Objects + Classes
Class → Blueprint
Object → Instance
4 Pillars:
👉 Shortcut Trick: "AEIP" (Abstraction, Encapsulation, Inheritance, Polymorphism)
Open this section to view and download past papers
Click on Show Past Papers to load available exam papers.