Real life example
Aapka mobile ek object hai: uski state (battery 80%, naam) aur behavior (call, photo) hai.
Industry example
Bank software me har Account ek object hai: balance (data) aur deposit(), withdraw() (kaam).
C++ code
class Account {
double balance;
public:
void deposit(double x){ balance += x; }
};
What happens when it runs
Account bana: balance = 5000. deposit(500) chala. Balance = 5500
Run the full program in the compiler Interactive version
Quiz
Object kis se milkar banta hai?
Object = state (data) + behavior (functions).
Try it yourself
Write one example of Introduction aur Objects from your own home, school or work. Then change the program in the compiler and run it again.
All 12 OOP lectures
- Lecture 1: Introduction aur Objects
- Lecture 2: Encapsulation aur Interface
- Lecture 3: Abstraction, Class, Inheritance
- Lecture 4: Inheritance ke Concepts
- Lecture 5: Association, Composition, Aggregation
- Lecture 6: Polymorphism
- Lecture 7: C++ me Class
- Lecture 8: Constructor
- Lecture 9: Copy Constructor, Destructor, this
- Lecture 10: this Pointer aur const Functions
- Lecture 11: const, Initializer List, static
- Lecture 12: static Functions aur Array of Objects
START WELL TO END WELL