Тёмный

C++ Operator Overloading beginner to advanced (in-depth explanation) 

Подписаться
Просмотров 245 тыс.
% 8 115

📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.
Download Visual Assist here: bit.ly/WT-CB
I use it to enhance the performance, features, and support for C, C#, and C++ development in Visual Studio.
Download Ultra Edit here: bit.ly/UE-CB
It is a powerful, secure text editor designed specifically for programmers.
In this video, I'll explain C++ Operator Overloading from beginner to advanced and teach you about operator functions.
In C++ overloaded operators are functions with special names: the keyword "operator" followed by the symbol for the operator being defined (ex. operator+, operator-, operator==, etc.)
Which operators can be overloaded?
- Most operators can be overloaded, the exceptions are . (dot) :: ?: sizeof
There are two types of operator functions: global operator functions and member operator functions.
In the video, I'll teach you about both and I'll also demonstrate how to do operator overloading for the most important operators and explain common errors that happen with operator overloading
🎁 Download PVS-Studio for free with #code_beauty promo code: bit.ly/PVS-StudioFreeCB1
▶️ PVS-Studio RU-vid channel - ru-vid.com/show-UCgOtSopdNjACcxXQpdGQEnA
🇫 PVS-Studio Facebook group - StaticCodeAnalyzer
☕ If you've found my content helpful and would like to support me, you now have the option to buy me a coffee or a cookie! It's a small gesture of gratitude that means a lot to me and helps me keep creating free educational videos for you. Use the link to make a contribution: bit.ly/CodeBeauty_BuyMeACoffee
However, please don't feel obligated to do so. I appreciate every one of you, and I will continue to share valuable content with you regardless of whether you choose to support me in this way. Thank you for being part of the Code Beauty community! ❤️😇
C++ Structures - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-9j5KkOC_goQ.html
C++ Classes and constructors - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-iVLQeWbgbXs.html
Contents:
00:00 - Intro
01:01 - This is how I analyze my code
01:54 - Introduction to operator overloading and operator functions in C++
07:29 - Ostream operator overloading (insertion operator)
18:12 - Overloading += operator
21:35 - Different types of operator functions (global vs member functions)
23:57 - Ostream operator overloading (insertion operator)
26:57 - Overloading -= operator
28:34 - C++ operator overloading common errors
34:16 - Results of the PVS-Studio code analysis
Follow me on other platforms:
Instagram 📸 - TrueCodeBeauty
Twitter 🐦- TrueCodeBeauty
*******CODE IS IN THE COMMENTS*******

Наука

Опубликовано:

 

30 июн 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 409   
@CodeBeauty
@CodeBeauty 3 года назад
📚 Learn how to solve problems and build projects with these Free E-Books ⬇️ C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook 🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/ Experience the power of practical learning, gain career-ready skills, and start building real applications! This is a step-by-step course designed to take you from beginner to expert in no time! 💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10). Use it quickly, because it will be available for a limited time. #include #include #include using namespace std; struct RU-vidChannel { string Name; int SubscribersCount; RU-vidChannel(string name, int subscribersCount) { Name = name; SubscribersCount = subscribersCount; } bool operator==(const RU-vidChannel&channel) const{ return this->Name == channel.Name; } }; ostream& operator
@hbm293
@hbm293 3 года назад
For the RU-vidChannel::operator==() you may first check whether (this == channel) so that you know it's the same object (comparing the object to itself) and can skip any other sort of member-equality checks.
@hbm293
@hbm293 3 года назад
It should also be noted that, here you have chosen the simple case where you use a struct, so all its members are public. When a class is used with private or protected members, you'll need to tell the class that these overloaded global operators are "friend" of the class.
@parthmakode5255
@parthmakode5255 3 года назад
please tell why we cant print yt1 and yt2 in the same line ?i know you have explained how to fix it but the reason why we cant do that isn't there . Could you post any link where this issue has been discussed?cause when I searched i got nothing
@hbm293
@hbm293 3 года назад
@@parthmakode5255 Do you mean printing them in the same line of code? or?
@parthmakode5255
@parthmakode5255 3 года назад
@@hbm293 yup, in the same line of code
@tactlesscloud2784
@tactlesscloud2784 2 года назад
You somehow got me to understand a concept in 30 minutes where my professor couldn't for a whole semester thank you so much for the videos. They're really carrying me through college!
@remimonsel9944
@remimonsel9944 Год назад
I spend hours watching your videos and every times I say "ohhhh that's why". You can't imagine how many times you explain me things that others never succeeded in teaching me.
@ghazanfarghaffar1249
@ghazanfarghaffar1249 18 дней назад
didn't expect a woman explaining operator overloading flawlessly. (thankyou)
@CodeBeauty
@CodeBeauty 18 дней назад
🥰🥰
@matijaxzivkovic8843
@matijaxzivkovic8843 3 года назад
We all loves this girl. She is amazing!
@CodeBeauty
@CodeBeauty 3 года назад
Thank you! 😄😄
@user-mt8wp7ft6z
@user-mt8wp7ft6z 3 года назад
It's at the midnight , a.m. 30,in Taiwan, and I will look this video in the morning!
@CodeBeauty
@CodeBeauty 3 года назад
Good night! 😴💤
@claritydive
@claritydive Год назад
I've been studying computer science for almost 3 years and this is the first time I've truly understood this. Thank you.
@chriscarlin3972
@chriscarlin3972 3 года назад
I haven't used c++ in years and these videos make for a great refresher on how things work. Also love when she says the work parameters
@aesthetic.__.writes8885
@aesthetic.__.writes8885 4 месяца назад
Tommarow is my final term paper so I am so confused about operator overloading but after watching this video , now I so comfident... Thanks Mam your effort is priceless the way you teach programming is very amazing...Thanks for helping us. Big respect from pakistan..
@satvrii
@satvrii Год назад
We can never get bored in your lectures! Your way of teaching is fab 😊
@arianevigested1625
@arianevigested1625 2 года назад
Thank you so much for this! Our professor ran low on time when it came to describing operator overloading, and this video has helped me understand a bit better what to expect. Test next week and I feel a bit better prepared after watching a few of your videos!
@siddharthpawar552
@siddharthpawar552 3 года назад
You come up exactly with the topic that i look forward to learn. 😄🤘
@CodeBeauty
@CodeBeauty 3 года назад
Glad to hear it! 😄😄
@codystar3669
@codystar3669 3 года назад
I also shared this type of video Please visit and seee ♥️ Thankyou for listening ✨ #seriescplusplus
@jassielitu
@jassielitu Год назад
Every seconds I watched, I learnt something new. Wonder how many more good people we have in this world. Thanks a lot!
@deveshsingh3237
@deveshsingh3237 Год назад
I watched so many videos on operator overloading, and i can confidently say this is hands down the **BEST** video on this topc, thank you so much for explaining it this clearly. made my day
@kutch2426
@kutch2426 2 года назад
This video was golden. I had struggled with this specific topic for quite a long time, and this explanation was perfect. Thank you!!
@codymetz8689
@codymetz8689 2 года назад
great video. In my class that i'm taking, all the ostream overload examples specified the data type beforehand. Seeing the conflicts that come with overloading with a void function that you showed helped with making sense of it.
@klasr5837
@klasr5837 3 года назад
Thank you saldina
@CodeBeauty
@CodeBeauty 3 года назад
You are so welcome! ❤️♥️❤️
@barshachaudhary982
@barshachaudhary982 3 месяца назад
So far the best video I have found for operator overloading
@muhammadumair6554
@muhammadumair6554 3 года назад
Waiting!!! I hope that's gonna be another fantastic video❣️
@CodeBeauty
@CodeBeauty 3 года назад
Hope you enjoyed it! ❣️❣️
@muhammadumair6554
@muhammadumair6554 3 года назад
@@CodeBeauty Surely, you are ❣️
@codystar3669
@codystar3669 3 года назад
I also shared this type of video Please visit and seee ♥️ Thankyou for listening ✨ #seriescplusplus
@likami6830
@likami6830 2 года назад
I've started learning from you when I'd looked for tutorial about maps but now I just can't stop studying different topics I discovered here. Programming became such a cool thing for me. I always find something new, see old topics in a new light and it's such a feeling... thank you so much!!! This June is amasing because of you^^
@CodeBeauty
@CodeBeauty 2 года назад
Thanks for this comment, it made my day. I'm so happy for you 🤞☺️🥰
@duesenberger
@duesenberger 3 года назад
Very helpful! Great step by step inroduction.
@anshulbansal8828
@anshulbansal8828 3 года назад
every minute of this video is worth it, thankyou beauty to help us enhance our coding skills... I love the way how small and side error cases you taught with so much simplicity, I have done 2 DSA courses till now, they had never given any importance to Operator Overloading, just taught the syntax, told this is overloading, enjoy students!
@CodeBeauty
@CodeBeauty 3 года назад
Thank you Anshul 🤗☺️🥰
@tom46dude
@tom46dude Год назад
I agree. Best explanation of Operator Overloading ever.
@oatie4262
@oatie4262 2 года назад
Thanks very much for articulating the concept so clearly! I also appreciated that you explained (23:18) why, when overloading the
@orangindodinewzealand8038
@orangindodinewzealand8038 2 года назад
in my "opinion", she needed to pass the value of yt1 which has the name and subscribers and also needed to pass the ostream datatype in order for the function to know what is the value (could be "cout" or "cin" or anything), unlike the += she just need to pass the yt1 to be added later in mycollection list, and she called a "method(which is from the operator +=)" in mycollection(which the list is already within the scope, you just need to access from it) to behave(which is push_back the yt1 to the list) so basically, she just needed to pass yt1. *correct me if im wrong
@Rsdawg5519
@Rsdawg5519 Год назад
This video was absolutely great! I coded along with you and that made it so much easier to understand! Your teaching is excellent!
@abimediae5790
@abimediae5790 Год назад
You are exceptional coder; you made the concept so clear. Thank you.
@mexxiano
@mexxiano 3 года назад
Wonderful! Awaiting for this very interesting topic! Thank you!!!
@CodeBeauty
@CodeBeauty 3 года назад
You're most welcome! Hope you enjoyed it! ❣️❣️
@zahidgul5811
@zahidgul5811 2 года назад
what an explanation. It have not seen on youtube, who can better explain than this. Thanks for taking your time to provide with such great videos.
@macko7177
@macko7177 2 года назад
Well explained! She deserves a lot of credit. Subscribed!
@hussainaqeel7371
@hussainaqeel7371 3 года назад
Hey Saldina! Great video! Thank you gor all the content you create! I wanted to ask if you had a video on working with memory allocation etc on C/C++?
@DON9307
@DON9307 Год назад
You gave a great explanation of operator overloading. I especially appreciated the explanation of the errors at the end for the -= operator.
@sakshamdogra
@sakshamdogra Год назад
Finally somone who explains with simplicity❤️
@LymariArzola
@LymariArzola 2 года назад
This was an amazing tutorial. Thank you!
@venkatsai817
@venkatsai817 2 года назад
Thanks for such an indepth explanation of operator overloading concept .I have a clear clarity on all oops concepts . It really helps in my job interviews and stuff.
@aryanverma6261
@aryanverma6261 Год назад
Best tutorial on RU-vid!
@granumuse7847
@granumuse7847 3 года назад
cout
@CodeBeauty
@CodeBeauty 3 года назад
Great that you're trying to figure it out on your own 😄
@prashantkumarsharma2306
@prashantkumarsharma2306 2 года назад
WOW!!! You make things so simple !!!
@Max-uk3kr
@Max-uk3kr 2 года назад
Great video, definitely gave me a better understanding of overloading operators.
@flaviocampos3581
@flaviocampos3581 Год назад
You got a sub. I watched another video about this got a little bit confused... but now is as clear as water. Thank you.
@technologyrealmresources
@technologyrealmresources 4 месяца назад
Amazing video, thank you!
@gautamgandotra9965
@gautamgandotra9965 Год назад
best video till now on operator overloading thank you.
@erikchen6883
@erikchen6883 2 года назад
Thank you. You are awesome, CodeBeauty! Very knowledgable and able to articulate C++ terms and concepts!
@drulli1
@drulli1 5 месяцев назад
Great tutorial, as always. You are awesome! 🤗
@malatini_ytb
@malatini_ytb 2 года назад
You're the best !! Thanks a lot for this video !
@giftkuzwayo3077
@giftkuzwayo3077 7 месяцев назад
Literally saving my career. Thank You soo much!!!
@RaverBorn
@RaverBorn 2 года назад
Another awesome video! Thank you!
@careerspack
@careerspack 3 года назад
The hottest coder online. One more reason to study coding.
@arpitgupta1765
@arpitgupta1765 Год назад
Best explantion I could find for Operator Overloading :)
@sonetadhikary675
@sonetadhikary675 Год назад
oNE OF THE BEST VIDEO ON OPERATOR OVERLOADING IN RU-vid.
@kailas813
@kailas813 Год назад
Really this video helps a lot to understand the complete picture of the operator overloading concept. Thank you.
@thirstforknowledge7634
@thirstforknowledge7634 3 года назад
Thank you very much for making this amazing video !!
@maxbretschneider6521
@maxbretschneider6521 Год назад
Great explanation, thanks!
@morshedraiankhan6968
@morshedraiankhan6968 Год назад
Finally understood the concept of operator overloading. Thank you.
@jolly_dollyyy
@jolly_dollyyy 2 года назад
surreal explanation ❤ ma'am hats off!!😊
@Ghisisan_
@Ghisisan_ 3 года назад
A very fine video, indeed. Thanks! 😊
@CodeBeauty
@CodeBeauty 3 года назад
Glad you enjoyed it! 😊❤️❤️
@dianelysrocha7156
@dianelysrocha7156 2 года назад
This is so cool!!
@sydwellnkhabela387
@sydwellnkhabela387 3 года назад
you are amazing. With the covid 19 currently high in South Africa. i can safely stay at home and learn from your videos. I'm looking forward towards your new content
@powerpoint444
@powerpoint444 Год назад
The best tuturial on YT
@gisellemusa4403
@gisellemusa4403 Год назад
your explainations are perfect !!
@sanjishmaharjan557
@sanjishmaharjan557 3 года назад
You are a great teacher. lots of love❤
@kasimsche2812
@kasimsche2812 3 года назад
She is sooooo amazing, very confident and very precise, perfect. 👌🏻👌🏻👌🏻💯💯💯❤❤❤
@bhimbdrlama
@bhimbdrlama 2 года назад
This topic gave a headach.. but the way you explain..I really gave me a relief.
@tayyabamir8767
@tayyabamir8767 2 года назад
Your videos helped me alot in learning , very much interesting.
@MCBREDL
@MCBREDL Год назад
very well explained thanks a lot. saved me a lot of time to understand overloading.
@swayam50
@swayam50 3 года назад
Thanks for this amazing explanation ❤️
@itstrue3490
@itstrue3490 2 года назад
I really appreciate your deep explanation about concepts.....and thank you so so much
@Joshwuhh
@Joshwuhh Год назад
VERY helpful thank you!
@OnPoint760
@OnPoint760 Год назад
thank you for breaking it down. great video
@SharuxD
@SharuxD Год назад
I am speechless Amazing Explanation
@fusion1388
@fusion1388 2 года назад
Best Explanation Ever 👍
@avinashgupta2308
@avinashgupta2308 2 года назад
I was finding a tutorial on operations overload, and now I can say that I found the best one. 🔥
@CodeBeauty
@CodeBeauty 2 года назад
🥳🥳😘
@ahmedmontasser1248
@ahmedmontasser1248 Год назад
Best instructor,,, thanks for the detailed explanation.
@user-cn6hw5lu5s
@user-cn6hw5lu5s 3 года назад
Thumbs up, thank you very much!
@CodeBeauty
@CodeBeauty 3 года назад
You are so welcome! ❤️♥️❤️
@shendoo2020
@shendoo2020 2 года назад
Thank you, This video is very helpful to understand operators override.
@user-mk9ye9sx4x
@user-mk9ye9sx4x 4 месяца назад
very helpful! thank you so much
@esharccycling5188
@esharccycling5188 3 года назад
I have been developing C++ simulators for the mines, road transport and army for the last 8 years and I enjoy watching your videos as a refresher on the basics. Perhaps you can do videos or a tutorial series on version control, the different types and their pros and cons. Also maybe consider doing it on Issue and Project tracking like Jira or JetBrains. I know I did not have a clue about these when I just started and I think they are important for beginners to know about which the Universities do not teach (or at least my one did not when I was studying there. I am 41 by the way and only started coding when I was 29
@fbonta13
@fbonta13 Год назад
I'm looking forward to the day when all of the stuff I currently find hard in my class will be considered basic stuff
@learnwithme7750
@learnwithme7750 2 года назад
Wow!! What an amazing video this is!! I enjoyed every second of this video about operator overloading... Thanks Saldina for wonderful explanation...
@refikalpertuncer8512
@refikalpertuncer8512 3 года назад
Well explained. Good content, definetely.
@majdijaiel6668
@majdijaiel6668 3 года назад
I love How you explain things, please make more videos about this same topic PLEASE
@mba2ceo
@mba2ceo 2 года назад
She is BEST teacher I EVER had ... but I still feel inept. Thank U !!!
@devman8119
@devman8119 3 года назад
Thanks for the video and Please continue the linked list lectures. Thank you🙂
@user-ng8rl3jb1i
@user-ng8rl3jb1i 8 месяцев назад
i wish i ll become a programer like you someday. im preparing for my entrance exams in informatics and computer engineering and i have so much to do
@NilavarsanManimaran
@NilavarsanManimaran 3 месяца назад
This is the best explanation that i have ever seen so far, taking consideration of all the domains in c++.
@NilavarsanManimaran
@NilavarsanManimaran 3 месяца назад
i am a 3rd year student, any i have learned java, python, js etc.. but c++ attracted the most of all, can u suggest some domains in c++, so that i can get easy interns.
@lucid-louisfromouterspace6918
@lucid-louisfromouterspace6918 3 года назад
Amazing. I am struggling in a college program in OOP. CodeBeauty is the way i can keep my high score, everything my teacher teaches bad, Saldina explains it perfectly. Today was operator overloading in class and i was stucked. Like a miracle, this video appears. I can solve my homework because of that. Thousands thank you Saldina. May i ask a tuto about the friend function, for my next class? Thank you sooooo much!
@Shadow-lx9rh
@Shadow-lx9rh 2 года назад
Thank you soo much whatever u spoke was very much understandable ,each and every part of it made me understand the code even more in dept. A heartfelt thanks🙏
@parthdeshwal4419
@parthdeshwal4419 Месяц назад
mam you're one of the best tutor of programming on youtube ....your way of explaining is very simple yet effective.....i would request you to create a course on react js and other web technologies... thank you
@Ijamhuang
@Ijamhuang 2 года назад
good video for c++ tutorial~ thanks a lot
@alexfrozen
@alexfrozen Год назад
Thank you! Amazing)
@quocanhtruong8897
@quocanhtruong8897 3 года назад
thank a lot Mrs!!👍👍 your teach is so detail and clear
@CodeBeauty
@CodeBeauty 3 года назад
🤗🥰🥰
@jasnarmstrng
@jasnarmstrng Год назад
"I was like ohhhhh, now I get it". Thanks, you made this language feature easy to understand.
@CodeBeauty
@CodeBeauty Год назад
I'm glad my video helped you. 🥰❤️
@nikhielsingh748
@nikhielsingh748 2 года назад
best video EVER !!!
@stevenkarrer1113
@stevenkarrer1113 Год назад
very good, thank you alot!
@abeerkh8941
@abeerkh8941 2 года назад
It's so helpful, Thank you very much...
@-_-5070
@-_-5070 2 года назад
You're just amazing 💗
@emirhandemir3872
@emirhandemir3872 Год назад
Best C++ channel on RU-vid ever :)
@CodeBeauty
@CodeBeauty Год назад
🥰❤
@sameermubeen8495
@sameermubeen8495 25 дней назад
Very helpful!!
@TejasDhule
@TejasDhule 2 года назад
You Are Just Amazing!
@mradneer7915
@mradneer7915 Год назад
We thank you for your tremendous efforts. Please persevere
@anxonpues6018
@anxonpues6018 7 месяцев назад
good examples, explanation rich and at the saame time easy would try to remember all
@rohanpatil839
@rohanpatil839 2 года назад
I am facing difficulties in operator overloading from a while, had seen many lectures but couldn't understood. Now I saw your lecture mam my concept became very clear and I am now able to solve problems on operator overloading. Thank you mam. Lots of love❤️❤️❤️
@dileepbokka5525
@dileepbokka5525 2 года назад
Thank you , excellent teaching Madam