C++ Tutorial for Beginners #17 | Operator Overloading in C++
SyntaxPilot
0:00 / 0:00
C++ Tutorial for Beginners #17 | Operator Overloading in C++
1 просмотр · 13 ч назад
SyntaxPilot
37 подписчиков
1 просмотр · 13 ч назад
C++ Tutorial for Beginners: Episode 17 of SyntaxPilot's free C++ full course, with real-life examples for every concept. Operator Overloading in C++.
In this video you'll learn:
• Why a + b fails for your own class
• Writing operator+ as a member function
• Keeping objects valid in the constructor
• Printing objects with operator‹‹ (and why it returns ostream&)
• Comparing objects with operator==
• Why != is not free in C++17
• What you can and can't overload
• Mini project: a shopping cart with a Money class
Every concept starts with a real-life example, then an animation and notes, then live code in the SyntaxPilot online compiler.
Practice free in the SyntaxPilot compiler (nothing to install): https://syntaxpilot-learning-2026.web...
Detailed notes for this episode (code, outputs, practice): https://syntaxpilot-learning-2026.web...
Chapters
00:00 Welcome
00:21 Today's agenda
00:35 The train trip
00:59 The obvious attempt
01:33 operator+
03:11 Keeping objects valid
03:48 Printing with cout
05:39 operator==
06:55 The rules
07:38 Common mistakes
08:04 Mini project: shopping cart
10:25 What you invented
10:49 Quick quiz
11:07 Recap and homework
11:34 Next episode
Next episode: Friend Functions, Static Members and this in C++
Post your homework and quiz answer in the comments, and subscribe for the full basic-to-master playlist, free.
#CPP #CPPTutorial #SyntaxPilot