Operator Overloading Introduction | C++ Tutorial

  Рет қаралды 11,749

Portfolio Courses

Portfolio Courses

2 жыл бұрын

How to use operator overloading in C++ to redefine how different standard operators work with different types of objects. Source code: github.com/portfoliocourses/c.... Check out www.portfoliocourses.com to build a portfolio that will impress employers!

Пікірлер: 14
@nabir14
@nabir14 Ай бұрын
I was stuck writting a program as i was confused about operator overloading but your video fixed my problem and I fully understood operator overloading. THANK YOU SO MUCH!
@nullifier_
@nullifier_ 2 ай бұрын
so in short: operator overloading is really telling a class how their objects should behave when they are put along into operations.
@benvingarten3674
@benvingarten3674 Жыл бұрын
Hey, great video, what would happen if you would write: Number c = 4 + a; now the "this" object is 4 and not an instance of the Number class. how would you write the operator + then?
@cheeseboi9740
@cheeseboi9740 6 ай бұрын
You would recieve an error, because the parameter is defined as an instance of the Number class, and if you wanted it to work like that you would need to define another overload.
@batebo2047
@batebo2047 Ай бұрын
Love you
@lradhakrishnarao902
@lradhakrishnarao902 Жыл бұрын
Why did you use const keyword in the overloaded operator?
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Great question! :-) It's 'const' because we're not going to change the "operand". We return a new number in the case of + and a bool in the case of ==, but in either case, we will not change the operand so we make it const.
@sabaresand7309
@sabaresand7309 8 ай бұрын
@@PortfolioCourses Thanks for this clarification, because I thought 'const' was a mandatory one
@mongraal2272
@mongraal2272 2 жыл бұрын
Sir can u plz do a video how Read an array of structs in C from a file
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
I agree this is a good idea, it's on my 'todo list', one day I will make a video like this. :-)
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
Here's a video I just made on reading and writing an array of structs from a binary file: kzfaq.info/get/bejne/Zrmbl6Sgu-C7oJ8.html. One day I will make a vide on reading and writing an array of structs from a text file too.
@mongraal2272
@mongraal2272 2 жыл бұрын
@@PortfolioCourses thaaaaaks!!!
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
@@mongraal2272 you're welcome!
@OmidKazemini-pg5ix
@OmidKazemini-pg5ix 9 ай бұрын
Can you tutor me? :)
How To Implement Method Chaining | C++ Tutorial
6:20
Portfolio Courses
Рет қаралды 3,6 М.
OPERATORS and OPERATOR OVERLOADING in C++
12:44
The Cherno
Рет қаралды 367 М.
Best Toilet Gadgets and #Hacks you must try!!💩💩
00:49
Poly Holy Yow
Рет қаралды 22 МЛН
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 27 МЛН
Son ❤️ #shorts by Leisi Show
00:41
Leisi Show
Рет қаралды 3,9 МЛН
this Keyword And Use Cases Explained | C++ Tutorial
10:30
Portfolio Courses
Рет қаралды 6 М.
C++ Overloading the Assignment Operator  [4]
17:38
Professor Hank Stalica
Рет қаралды 5 М.
Exception Handling | C++ Tutorial
14:49
Portfolio Courses
Рет қаралды 16 М.
how Google writes gorgeous C++
7:40
Low Level Learning
Рет қаралды 838 М.
Member Initializer Lists | C++ Tutorial
23:10
Portfolio Courses
Рет қаралды 8 М.
Object Oriented Programming (OOP) in C++ Course
1:30:26
freeCodeCamp.org
Рет қаралды 2,5 МЛН
Define A Copy Constructor To Create A Deep Copy Of An Object | C++ Tutorial
17:06
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 302 М.
Dynamic Binding (Polymorphism) With The Virtual Keyword | C++ Tutorial
9:57
Читерская рыбалка!🤯🐟 (@fishinglover790)
0:24
Взрывная История
Рет қаралды 1,4 МЛН
 tattoo designs  #tubigontattooartist #nctdream #straykids #txt
0:17
Hp Shorts video
Рет қаралды 29 МЛН
ПАЛОЧКИ + БУТЫЛКА = ВАЗА😳🥢
0:52
polya_tut
Рет қаралды 3,4 МЛН
Забота Казахов🇰🇿
0:45
QAZAQ PEOPLE
Рет қаралды 457 М.