Real life example
Class ki attendance register: students ki array, har entry ek object.
Industry example
Online store: Product products[100] array par loop chala kar inventory check hoti hai.
C++ code
Student s[3]; // 3 objects
for(int i = 0; i < 3; i++)
s[i].show();
What happens when it runs
Teeno objects ka default constructor chala (3 dafa).
Run the full program in the compiler Interactive version
Quiz
static member function me this milta hai?
static function kisi object ka nahi hota, is liye this nahi hota.
Try it yourself
Write one example of static Functions aur Array of 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