Real life example
Gaari chalane ke liye steering, brake, accelerator chahiye. Engine ke piston ka hisaab nahi.
Industry example
Food delivery app: Rider class me naam, location, order rakhte hain. Rider ki pasandeeda chai ka data nahi.
C++ code
class Vehicle { public: void start(){} };
class Car : public Vehicle {
public: void ac(){}
};
What happens when it runs
Car ne Vehicle ka start() mufat me liya aur apna ac() joda.
Run the full program in the compiler Interactive version
Quiz
Abstraction ka matlab?
Zaroori cheez rakho, baaqi chhodo.
Try it yourself
Write one example of Abstraction, Class, Inheritance 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