Q1
How is a Class vs Object in C++ like a cookie cutter vs real cookies—and why keep member variables `private`?
A class Hero is the blueprint (health, name), while Hero p1, p2; creates real independent hero objects in memory. Keeping health private lets takeDamage() block negative illegal health bugs cleanly!
Q2
Why is std::vector<int> better than a fixed C-style int scores[10] array for keeping track of dynamic game items?
A fixed array runs out of space at item #11 or wastes unused slots; std::vector automatically grows cleanly with .push_back() and knows its own .size()!
Q3
How does Function Overloading let C++ define two functions both named add (add(int, int) and add(double, double))?
C++ distinguishes functions by both name AND parameter types, automatically picking the exact right version at compile time.
Q4
What is the key difference between passing void boost(int hp) (Pass by Value) vs void boost(int &hp) (Pass by Reference)?
Pass by Value only edits a throwaway clone inside the function, leaving the hero's real HP untouched! Adding & (Pass by Reference) lets boost() update the caller's real hp variable directly.
Q5
Why does std::getline(cin, fullName) get skipped right after cin >> age; unless cin.ignore() clears the leftover Enter newline?
cin >> age reads digits yet leaves the invisible '\n' Enter keypress sitting in the input buffer—so getline immediately reads an empty line unless cin.ignore() flushes it!
Q6
How does a Constructor (Hero(string n)) guarantee objects start clean without garbage stats?
The Constructor runs automatically the exact moment an object is created, initializing names, scores, and starting coordinates cleanly every time.
Q7
Why does Inheritance (class FlyingEnemy : public Enemy) avoid copying identical HP/movement code across 10 game enemies?
Shared traits (hp, takeDamage()) live once inside the base Enemy class while FlyingEnemy inherits them automatically and adds only new flying behavior.
Q8
Why does forgetting using namespace std; vs writing std::cout matter in bigger C++ projects?
Typing std::cout explicitly avoids name collisions when two libraries both invent a function named count or max.
Q9
What does const on a variable (const int MAX_LIVES = 3;) stop accidentally?
const asks the C++ compiler to block any accidental code trying to overwrite fixed game rules later.
Q10
How do for (int x : scores) range-based loops prevent off-by-one array bugs cleanly?
Range-for loops automatically visit every element from start to finish without needing manual i = 0; i < size counter indexes.