⚡
STUDENT NOTES · C & C++ WEEK 6 OF 8
C Gets a Superhero Upgrade ⚡
Everything you know still works — and now: cout, classes, and objects that build themselves.
1cout — printf's cooler successor
⚙️
Chip: cout << streams things OUT, cin >> streams them IN. No %d placeholders — C++ figures out the type itself. The arrows show the direction of travel.
2Classes — blueprints for objects
🦉
Professor Hoot: A class is a blueprint (like struct + superpowers); an object is one thing built from it. Data + the functions that use it, packed together.
3Constructors — objects that build themselves
🤖
Bittu: The constructor runs AUTOMATICALLY at the moment of birth. Create a Hero, hear "Suit up!" — no manual call needed.
🐞
Bugly: Psst — forget the semicolon after the class's closing brace }; and the compiler writes you a poem of errors. Hehehe.
4Function overloading — one name, many moves
5Quick quiz! 🧠
In C++, class members are ________ by default.
💡 class = private by default (the Batcave model). struct = public by default (the town square).
When does a constructor run?
💡 Object born → constructor fires. Setup happens by itself.
6Your mission 🚀
Mission 1: Rewrite Week 1's hello program with cout. Feel the upgrade.
Mission 2: Build a class Dog with a constructor that prints "Woof! I exist!". Create 3 dogs.
Mission 3: Overload greet(): one version takes a name, another takes a name and a language.
Week 6 complete — object-oriented! ⚡
Next: inheritance, virtual functions and the mighty STL.
Go to Week 7: OOP Power & STL →