Exception handling in C++ (How to handle errors in your program?)

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ม.ค. 2025

ความคิดเห็น • 307

  • @CodeBeauty
    @CodeBeauty  3 ปีที่แล้ว +28

    📚 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.

    • @abdullahfaisal1265
      @abdullahfaisal1265 ปีที่แล้ว

      Hi saldina, can you please share the code in your pinned comment as a github link or as a txt message it really helps before the evalution. Thank you for lessons.

  • @General_Boo
    @General_Boo 3 ปีที่แล้ว +52

    PLEASE never delete your channel/videos!!
    Your content is so useful

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +14

      I won't delete it. 😃 I'm hoping to reach even more people and help them learn programming. Thank you! 💜

    • @spencerignatescue158
      @spencerignatescue158 2 ปีที่แล้ว +2

      Ah , I can't tell if your just simping or if this is meant to be sarcastic .

    • @mr.erikchun5863
      @mr.erikchun5863 ปีที่แล้ว

      @@spencerignatescue158 the lonely virgin calling someone a simp. Smh

    • @budgetarms
      @budgetarms 8 วันที่ผ่านมา

      @@spencerignatescue158 yeah, because .... what is this video

  • @OCEAN-fc9wl
    @OCEAN-fc9wl 3 ปีที่แล้ว +30

    This channel is perfect for learning C++ in an organic and simple way.

  • @GhanBuri666
    @GhanBuri666 3 ปีที่แล้ว +4

    I love listening to you because you are explaining everything in the easiest possible way, but also you are speaking very clearly and have nice voice!

  • @fachriyasir661
    @fachriyasir661 3 ปีที่แล้ว +23

    Hi Saldina, Thank you for spending your time creating video about C++. I'm not a CS student and not really good at programming but you help me pass C++ class. Now I also start to get interested to programming. I feel blessed that I found your channel, so please keep making videos like this:))

    • @virtually2124
      @virtually2124 4 หลายเดือนก่อน

      um what is a "CS" student ?

    • @addie023_6
      @addie023_6 3 หลายเดือนก่อน

      @@virtually2124 Computer Science Student

  • @lukaadamovic8314
    @lukaadamovic8314 10 หลายเดือนก่อน +1

    Thank you very much Saldina. The handing of these exceptions is indeed very very VERY useful and I am truly happy that I have learned so much about this topic. Greetings from Brazil!!!!!!!!!

  • @multiplier007
    @multiplier007 3 ปีที่แล้ว +3

    You have got amazing teaching skills.
    You are the best than the teachers in university

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +1

      That is so nice to hear! Thank you very much! 💜

  • @rudrashiva
    @rudrashiva 3 ปีที่แล้ว +6

    I had a friend from Celic in Bosnia. You remind me of her. She is a teacher and you both have same personality. Maybe all Bosnian have same charming personality. Anyway your lessons on C++ are great for beginners.

  • @carboqaddumi3944
    @carboqaddumi3944 3 ปีที่แล้ว +3

    this channel single-handedly carried me through my freshman computer engineering year, seriously thank you keep doing this you're great! (:

  • @alexandruteodor3585
    @alexandruteodor3585 3 ปีที่แล้ว +37

    This tutorial is exceptional! :)

  • @umairawan3938
    @umairawan3938 3 ปีที่แล้ว +27

    Saldina is a great teacher ❤️

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +3

      Thank you UMAIR AWAN! 💜💜

    • @Javier-uh7mb
      @Javier-uh7mb 3 ปีที่แล้ว +1

      someone is in love with their teacher 🙊

  • @kinghadu9611
    @kinghadu9611 3 ปีที่แล้ว +7

    Saldina I don't know how you get the time to do all these videos but thank you so much for all the help you have given me I am loving programming thanks to your channel.
    I think a great video you can do would be building a project like one that uses a user made form and a database etc. Any sort of real world application that one would be expected to make when in the field would be awesome!!!!
    Again thank you so much for your incredible help in sharing your knowledge. I once read a post from a wise person he said that knowledge becomes wealth if it is shared freely but it becomes a weapon when it is kept by selfish people.
    Thank you for spreading your riches and bettering humanity!!!

  • @santoshsolanke7300
    @santoshsolanke7300 2 ปีที่แล้ว +1

    This channel is very perfect for learning C++ in an organic and simple way. she is teaching in very simple method
    spacially thanks, Mam for providing very helpful knowledge

  • @manoking9619
    @manoking9619 ปีที่แล้ว +2

    Your videos are so good that my professor takes your code and uses it for class lessons! Either that or you both code very similarly.

  • @nicholasoneal1521
    @nicholasoneal1521 3 ปีที่แล้ว +1

    Seriously, this is the best programming channel on youtube. U r awesome!

  • @preetichaudhari319
    @preetichaudhari319 3 ปีที่แล้ว +8

    Hey Saldina!
    I would really appreciate if you can make a detailed video on Operator Overloading including topics such as Fundamentals of Operator Overloading, Restrictions on Operators Overloading, Operator Functions as
    Class Members vs. as Friend Functions, Overloading Unary Operators, Overloading Binary Operators,
    Overloading of operators using friend functions.
    Thanks!

  • @ksprakashkumar
    @ksprakashkumar ปีที่แล้ว +1

    Hi Saldina, Thanks a lot for your effort in teaching C++. In this example, we can add one more print and demonstrate that fourth print will not get executed when third print got an exception.

  • @rakshitsen5110
    @rakshitsen5110 3 ปีที่แล้ว +4

    Big fan from india🇮🇳.
    Ma'am your video help c++ language
    a lot.
    Thank you so so much.

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว

      Thanks for the support. Greetings to India! 🇮🇳🥰🥰

  • @lusandamtembu7383
    @lusandamtembu7383 ปีที่แล้ว +1

    yoh, you saved me when i needed you most. thank you for your easy to follow and understand videos

  • @GlobStats
    @GlobStats 2 ปีที่แล้ว +6

    I can't thank you enough, you have a great method of explaining.

  • @dipenpandit684
    @dipenpandit684 2 ปีที่แล้ว +1

    it's my OOP exam in 2 days this video was absolutely helpul

  • @ignaciodelvalle158
    @ignaciodelvalle158 ปีที่แล้ว

    What I like about his videos is the pace and efficiency of what he explains. A discovery this channel!!
    It would be nice if you shared the code, although it is true that doing it by hand helps to understand it better.

  • @hbm293
    @hbm293 3 ปีที่แล้ว +6

    One of the important topics in C++, especially when using the STL as almost all of its functions will throw exceptions as soon as they encounter errors.

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +4

      Indeed, it is very important topic! Thanks for your help with replying the comments in the chat today! 😃💜

  • @aliafzal3029
    @aliafzal3029 3 ปีที่แล้ว +2

    hey seldena.. U have busy routine but still u spend time on us like making videos for us and share your knowledge with us and i think U r amazing 🙏💜

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +3

      Thank you so much. the support that I get from this community means a lot to me! You're the best! 💜💜💜
      it's Saldina*

  • @marcofe82
    @marcofe82 3 ปีที่แล้ว

    Ciao Saldina, really good explanation about exceptions. I've also appreciated your slow speak, cause in this way every single words is recognizable and it's possible to totally absorb the meaning of the lesson.

  • @phutrung3027
    @phutrung3027 2 ปีที่แล้ว +1

    This tutorial is very helpful for me. By many videos like this, I can learn not only coding but also English learning skill

  • @denishnatiuk921
    @denishnatiuk921 2 ปีที่แล้ว +1

    I Just couldn't grasp try catch blocks until this video thank you.

  • @ДмитрийБузницкий-б3н
    @ДмитрийБузницкий-б3н 2 ปีที่แล้ว

    Thank you for your lessons, Saldina. You have clear English pronunciation, I like it. My English isn't so good, may be pre-intermediate level, but I understand you. Aside from programming I will study English listening with your lessons :) With love from Russia

  • @yi-chongjiang5639
    @yi-chongjiang5639 3 ปีที่แล้ว +1

    LOVEEE this video explaining everything I need in detail!!
    Also love the summary part, it goes through everything again and makes the concept more solid!!
    thank you so much!

  • @zombiehellmonkeygaming1956
    @zombiehellmonkeygaming1956 3 ปีที่แล้ว

    Thank you for the video, I've learned exception handling already, but I always watch your videos in case I missed something when I first learned it, or you give a better explanation.

  • @jasswrites3195
    @jasswrites3195 3 ปีที่แล้ว

    Never stop making videos, you are doing a great work!!

  • @livedz9206
    @livedz9206 3 ปีที่แล้ว +6

    Hii love from algeria❤️your teaching skills are awesome

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +1

      Thanks and welcome! Greetings for Algeria! 💜

  • @mose999
    @mose999 ปีที่แล้ว +1

    I summerize a point which may be easily overlooked:
    in 12:39 you must use "a pointer" as the parameter , so if you throw a "string type var" , you use the const char * ,because we need a pointer,however,"string" doesn't have pointer and "char" do.And string is actually a "char"

  • @moularaoul643
    @moularaoul643 3 ปีที่แล้ว +2

    Thank you for all the time you give us!!!

  • @aleks_mag
    @aleks_mag 3 ปีที่แล้ว +1

    I like that your have tasks under video. So your make not just video it's very good content for learning.

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +1

      Yep, I often include small tasks so that my viewers can use them to practice on their own as well. Thanks! 😃😃

  • @ponluee
    @ponluee 3 ปีที่แล้ว +2

    Thank you for all the time that you teach us🙏❤️

  • @christiancarter255
    @christiancarter255 2 ปีที่แล้ว +2

    Advantages of using error handling methods over only using if-then statements?

    • @shaikhshehzad024
      @shaikhshehzad024 5 หลายเดือนก่อน +1

      Maybe for readability and you won't need to put a special return value for function in case you want to handle error.

  • @IJuniorX_X
    @IJuniorX_X 2 ปีที่แล้ว +1

    @18:22
    I'm curious how you were able to comment out the code all at once. Is there a shortcut?

  • @xaadadaa
    @xaadadaa 3 ปีที่แล้ว +2

    best programming channel i learned so much from u

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว

      I'm happy to hear that 🙏💙

  • @rohaannadeem914
    @rohaannadeem914 2 ปีที่แล้ว

    Your teaching way is superb

  • @selenahurloi5876
    @selenahurloi5876 2 ปีที่แล้ว

    you are so good at explaining, i love watching your videos and hopefully i will also pass the exam!!

  • @virtually2124
    @virtually2124 4 หลายเดือนก่อน

    unbelievable good, better than the book that divides a number by zero to get a throw, try, catch error.
    In the class chapter of the book, the example list class listing of a program and when it runs it goes "Woof, woof I am a two year old dog and I can wag my tail"
    and I think, "WHAT !!??, I could have written a program in BASIC to do the same thing."

    • @CodeBeauty
      @CodeBeauty  4 หลายเดือนก่อน

      if you like my teaching check my Practical Programming Course at www.codebeautyacademy.com
      We are building real desktop application in C# and you will be learning alongside other students, with me as your personal tutor. With this you will also gain access to exclusive Discord community.
      I'll be happy to have you there. :)

  • @danbrown6698
    @danbrown6698 3 ปีที่แล้ว +1

    You've explained exception quite clear.

  • @waqarahmad5939
    @waqarahmad5939 2 ปีที่แล้ว +1

    Wonderful explanation of exceptions. You made it easy.

  • @RobertSurma
    @RobertSurma ปีที่แล้ว +1

    Good diction, very clearly explained. Perfect!

  • @tamarabenjamin9089
    @tamarabenjamin9089 3 ปีที่แล้ว

    My favorite youtube teacher for C++.

  • @strategyschool
    @strategyschool หลายเดือนก่อน

    very clear and clean explanation. many congrats.

  • @wscamel226
    @wscamel226 ปีที่แล้ว +2

    Awesome. Thank you

  • @umairawan3938
    @umairawan3938 3 ปีที่แล้ว +12

    Most awaited!!!

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +2

      Happy to hear that! ❤️

  • @muhammetkaplan8869
    @muhammetkaplan8869 3 ปีที่แล้ว

    You are a perfect detail in this world :D keep going, as a nonnative English speaker I found your speaking is very simple but at the same time understandable perfectly :D

  • @BenskiGameWorks
    @BenskiGameWorks 15 วันที่ผ่านมา

    Thank you, clear explanation!
    Cheers!

  • @charlesschmidt4272
    @charlesschmidt4272 2 ปีที่แล้ว

    Very good concise introduction. Small point: there's a bug. Documents shorter than 10 characters will print without reducing the amount of available paper.

  • @skylerhawkins815
    @skylerhawkins815 3 ปีที่แล้ว +1

    Could anybody please explain to me why she throws an exception for a (const char * txtException) when the type of the exception is a string literal? Also why is there a need to use the "const" qualifier along with a pointer? I do not understand please help!

    • @celikvolkan
      @celikvolkan 2 ปีที่แล้ว +1

      According to the standard a text with double quotes is not a string. It is a const char *. This is because C legacy of C++. This address represents the address of the character array in ROM (.text code segment) part of the program. And it has to be const, not to let anybody to change it because as I said, those characters stays on the ROM side.

  • @4theloveoflife431
    @4theloveoflife431 11 หลายเดือนก่อน

    Thank you sooo much. This try catch throw stuff is quite tricky if you first touch it!!,😅

  • @tiantianliu5958
    @tiantianliu5958 11 หลายเดือนก่อน

    Great! Keep going code beauty! every interesting training.

  • @astudent797
    @astudent797 3 ปีที่แล้ว +2

    Could you please refer a open book pdf of c++ for better learning of programming

  • @chulbalytwins2450
    @chulbalytwins2450 2 ปีที่แล้ว

    saldina i salute your work you are so much hardworking

  • @nastaranheidarysharifabadi4648
    @nastaranheidarysharifabadi4648 ปีที่แล้ว

    thank you. Im begginer in cpp and its useful for me.🥰

  • @shubhamkalravevo1884
    @shubhamkalravevo1884 2 ปีที่แล้ว +1

    What a fantastic explanation.!

  • @broadbandmax
    @broadbandmax 7 หลายเดือนก่อน

    Not sure if already asked, how to does the exception work when propogating through a call stack?

  • @rosabeigi
    @rosabeigi 2 ปีที่แล้ว

    I find your content so useful

  • @digantachaudhuri
    @digantachaudhuri 3 ปีที่แล้ว +4

    Subscriber++;
    Thanks for this video, Nice explanation.
    ❤️ from India.

  • @fnati02
    @fnati02 ปีที่แล้ว

    hey!!
    first thank you for the video!!
    i would like to know when i use the default catch(...) how can i pass an argument to print the message?

  • @senalshamika9426
    @senalshamika9426 3 ปีที่แล้ว +1

    You are a great teacher saldina

  • @cyruis20k18
    @cyruis20k18 2 หลายเดือนก่อน

    thank you so much, I learned a lot

  • @learningprogram5288
    @learningprogram5288 3 ปีที่แล้ว

    Awesome. this is what i have been looking for. implementation on the topic and clear explanation.

  • @samael2187
    @samael2187 3 ปีที่แล้ว

    Amazing video you just helped me add exceptions to my final project thnx a lot

  • @samuelfe
    @samuelfe 3 ปีที่แล้ว

    Which extension is this one that places the spaces between, e .g "cout" and "

  • @rimaben438
    @rimaben438 2 ปีที่แล้ว

    Thanks a lot Saldina I am beginner in C++ I understand with more then my teacher i wrote all his exemples but when I compile gives errors

  • @amosreginaldjr.4200
    @amosreginaldjr.4200 3 ปีที่แล้ว

    C++ is beautiful when you understand it!

  • @nastaranhendijani681
    @nastaranhendijani681 11 หลายเดือนก่อน

    Thank you for your videos, I like them very much! very helpful!

  • @MrNYT
    @MrNYT 3 ปีที่แล้ว +2

    This vedio I really all the time which I want 🙏 thank mam

  • @nawledge4pwr
    @nawledge4pwr 3 ปีที่แล้ว

    Can you explain what the dot is for the char pointer?

    • @light_comes_with_patience
      @light_comes_with_patience 2 ปีที่แล้ว

      The dot is called an asterik *, and that's how you define a pointer type. Doing const char txtException would only define a constant char variable, but adding the * makes it a pointer. I am just confused on why she did const char* txtException and she only did int Excode without making it a pointer.

  • @aleksandarsherbula2081
    @aleksandarsherbula2081 3 ปีที่แล้ว +1

    Pozdrav iz Srbije. Video je bez error-a. :D

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +1

      Pozdrav za 🇷🇸
      🤗❤️❤️

  • @yash1152
    @yash1152 2 ปีที่แล้ว

    23:57 my only query/worry is that this way becomes way too dependent on both the function call as well as function implementation. In my mind:
    1. there should be some way within the function definition to try-throw-catch and jump back to caller function
    2. If the caller function contains an assignment after return, then skip that assignment and proceed to next stmt
    This aint ideal though, as it wont work in other expressions like comparison, or cout etc...

  • @chronologie2895
    @chronologie2895 3 ปีที่แล้ว +1

    I have a finished C ++ course in sololearn, could you give me a list of things that I must know to be a C ++ dev? I not sure if need learn more

  • @pranitkharat621
    @pranitkharat621 3 ปีที่แล้ว +1

    I am from India, mam ur awesome 🙌

  • @siphelelenxumalo6147
    @siphelelenxumalo6147 ปีที่แล้ว

    Hey Saldina , thank you so much for your videos, helps all the time🥺. Could you please also do a video on code smells in c++ ,like inappropriate intimacy, data class etc. and code refactoring

  • @kuldeeprane1469
    @kuldeeprane1469 3 ปีที่แล้ว

    Can you make video on projects we should include in our resume as a fresher

  • @nomesa7374
    @nomesa7374 11 หลายเดือนก่อน

    Wouldn't an "if statement with return" be much cleaner than Exception`? What is the adv of an exception compared to a simple if statement with return?

  • @GenjaOrigins
    @GenjaOrigins 3 ปีที่แล้ว

    So throw is something like print so if print exists then what more does throw offer

  • @thecaptain10
    @thecaptain10 ปีที่แล้ว

    can we throw the exception in main function as well instead of throwing it from the class

  • @user-xc9kj5so5u
    @user-xc9kj5so5u 3 ปีที่แล้ว +1

    I have only one question... how can I comment out selected code like you do at 19:24? That's so awesome

    • @yashprajapati8857
      @yashprajapati8857 3 หลายเดือนก่อน

      You can simply do it by selecting the text you want to comment out and pressing Ctrl+/
      You can also uncomment the text in the same way!

  • @jomarbombita5078
    @jomarbombita5078 3 ปีที่แล้ว

    Hmmp for me you are one great teacher
    So very clear and understable thanks😊

  • @atvuduy9238
    @atvuduy9238 3 ปีที่แล้ว

    Very good. I come from VietNam. I learn both English and C++

  • @papiermuecke7626
    @papiermuecke7626 3 ปีที่แล้ว +1

    I subscribed your channel because you explain so many c++ functions that i have never learned in my study! Also its very easy for me to understand everything because your english is so fluent! :-)
    It would be interresting, if it's possible to put parameters into default catch functions instead of these "...".
    Thank you very much!
    Love from Germany!

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +1

      There is no need for parameters in default catch, because it will catch any unhanded exception 🤗🤗

    • @CodeBeauty
      @CodeBeauty  3 ปีที่แล้ว +1

      regardless of its type 😃

  • @khanwazir6940
    @khanwazir6940 2 ปีที่แล้ว

    Hi saldina.i got the throw and catch block but i did not get the Try block because the try block in this c++ program you written here only prints statements once instead of three times
    .why it happens so..thank u

  • @malikmuhammadarslan9993
    @malikmuhammadarslan9993 2 ปีที่แล้ว

    You are Such a Legend
    please make C# videos

  • @Hiyori___
    @Hiyori___ 3 ปีที่แล้ว +2

    Amazing teacher, thank you

  • @monilcharola6873
    @monilcharola6873 2 ปีที่แล้ว

    Thank You !! Kudos to your good work !

  • @so_dispirited
    @so_dispirited 26 วันที่ผ่านมา

    you are so talented. i really mean it

  • @AhmedRaza-ty7zq
    @AhmedRaza-ty7zq ปีที่แล้ว +1

    Awesome video😎😎👍👍

  • @adi1257
    @adi1257 ปีที่แล้ว

    i have a question.....where is the link between txtException and no paper ? i still dont get it

  • @rajgiriyt8494
    @rajgiriyt8494 3 ปีที่แล้ว

    hey Saldina, How can I remove unnecessary messages shown in MS visual code debugging console, by not using system("pause>0") but from the main setting. please help me out.

  • @robbyrepublic
    @robbyrepublic 5 หลายเดือนก่อน

    Great job with explanations.

    • @CodeBeauty
      @CodeBeauty  5 หลายเดือนก่อน

      🚀🥰

  • @rosabeigi
    @rosabeigi 2 ปีที่แล้ว

    how can I open a binary python file in cpp code? I mean I added the library of python 310 to my project but I can not find any function to open my file in cpp project.

  • @o_o6869
    @o_o6869 3 ปีที่แล้ว

    i would love to learn coding,well appreciated Saldina.

  • @krentwhite2668
    @krentwhite2668 3 ปีที่แล้ว +1

    this video is very useful👍

  • @smokinjoe9415
    @smokinjoe9415 2 ปีที่แล้ว +3

    One problem with most of your tutorials, including this one, is that you should also point out flaws in your example code. The biggest flaw and easiest to explain is that in your example code, you should be passing the strings as const references instead of passing them in by value which causes huge performance problems due to all the unneeded string copies. For example your ctor should have const string &name instead of just 'string name' (bad performance hit). Same with print. and since you aren't modifying the strings passed in, make them const.
    Doing this will help create less newbies running around creating bad code. There are many other improvements that would make your code better and production quality, but in a beginner tutorial that is not a good idea - but using references instead of by value when possible is something a newbie should learn day one.

    • @tomastank1030
      @tomastank1030 2 ปีที่แล้ว +1

      That's exactly what I was thinking too. Passing a very large document by value will use up stack space so best pass a pointer or reference to the string document which is really passing an address to the document string. 👍

  • @mehdi-hw5no
    @mehdi-hw5no 3 ปีที่แล้ว

    Would you tell this theme name in visual studio?