Rule of Three in C++: Overloaded Assignment, Copy Constructor, Destructor

Поділитися
Вставка
  • Опубліковано 15 гру 2024

КОМЕНТАРІ • 95

  • @LowPCGame
    @LowPCGame 7 років тому +113

    OMG you explain better than my college professors!

    • @starzandearth
      @starzandearth 6 років тому

      ya jesus

    • @cpubug
      @cpubug 4 роки тому

      Wowow

    • @martint5340
      @martint5340 2 роки тому +1

      Most college profs suck big time at explaining so that doesn’t say much

    • @jollyroger6660
      @jollyroger6660 10 місяців тому

      this is exactly why I'm here. My prof is... not great at explaining this

  • @mistersir3185
    @mistersir3185 2 роки тому +4

    You chose an excellent example to explain this concept.

  • @Spawned98
    @Spawned98 6 років тому +9

    Six years after publishing, but still relevant and an excellent overview. Thank you!!!

    • @paula19335
      @paula19335 5 років тому +1

      7 years now and is still the best explination I found on UA-cam

    • @jensmalzer6344
      @jensmalzer6344 3 роки тому

      @@paula19335 8 years and still good

    • @rahulsarkar4530
      @rahulsarkar4530 2 роки тому

      @@jensmalzer6344 9 years and still good

    • @hadiyakhni4282
      @hadiyakhni4282 Рік тому

      @@rahulsarkar4530 10 years and still good

    • @sameerlama998
      @sameerlama998 2 місяці тому +1

      12

  • @PabitraPadhy
    @PabitraPadhy 8 місяців тому +1

    Single video explaining rule of 3, deep/shallow copy, why we need to delete heap objects created by the class in it's destructor, also possibly hinting where smart pointers could help
    This is a brilliant example.

  • @_Unlukey
    @_Unlukey 12 років тому +5

    Fantastic! I struggled to understand this in a lecture today but this has been a big help. Thank you!

  • @mertdenizalaydn3726
    @mertdenizalaydn3726 9 років тому +14

    supreme analogy with role play characters.

  • @Someguy-uh4lv
    @Someguy-uh4lv 4 роки тому

    Ive had 2 or 3 professors try to explain this concept and it never made any sense. This does. Thank you.

  • @markfraser5113
    @markfraser5113 11 років тому +2

    Had trouble understanding this in class but you made it very clear, thank you.

  • @nicolehsu4543
    @nicolehsu4543 10 років тому +3

    Thank you. I am preparing for my C++ final exam. It is really helpful.

  • @adnanmohamed6517
    @adnanmohamed6517 5 років тому +3

    Well explained!!
    I have read about this topic in a book. This was incredibly more understandable! Thanks a lot, and best of luck

  • @Schytheron
    @Schytheron 4 роки тому +1

    This was a god tier explanation! You've earned yourself a new subscriber!

  • @deepeshanna
    @deepeshanna 7 років тому

    Your teaching abilities are excellent !!

  • @abdulrahman0534
    @abdulrahman0534 3 роки тому +1

    Awesome video, Thank you!

  • @agnichatian
    @agnichatian 9 років тому +2

    Very clear explanation of the reasons behind the 'rule of three' - thanks.

  • @MdWahidurRahmanOvi
    @MdWahidurRahmanOvi 5 років тому +1

    Subscribed, I am so glad that I found this channel

  • @SalahMunadi
    @SalahMunadi 9 років тому

    amazing explanation man spent a semester and didn't understand these watched one video of urs and piece of cake

  • @apeasay
    @apeasay 10 років тому +1

    Thanks for an excellent video! The visuals are helpful and reinforce what you are talking about. You stay strictly on topic, and cover the material at a comfortable pace. Great stuff!

  • @airbus3738
    @airbus3738 Рік тому

    amazing explanation. you’re a great teacher. thank you!

  • @punchline1729
    @punchline1729 2 роки тому

    That's how you explain rule of three, perfection

  • @qwerty86567
    @qwerty86567 10 років тому

    Very nice video. You present a clear and succinct exposition of the concepts. Thanks!

  • @srishtikumar5544
    @srishtikumar5544 6 років тому

    Fabulously explained. I used to have much trouble with this.

  • @LerenaHolloway
    @LerenaHolloway 4 роки тому +1

    Great video! Everything just made so much more sense now. Thank yoU!!

  • @azimhashmi6694
    @azimhashmi6694 6 років тому

    best explanation very good and easily understandable. thank you sir.

  • @kabm
    @kabm 4 роки тому

    What a brilliant exploration!

  • @Jaggerswagger1
    @Jaggerswagger1 8 років тому +2

    This video was extremely helpful! Thank you!

  • @SilverDuler
    @SilverDuler 7 років тому +9

    D Y N A M I C A L L O C A T I O N baby

  • @johnmurphy1248
    @johnmurphy1248 6 років тому +2

    Awesome explanation, thank you!

  • @pakistanipatriot100
    @pakistanipatriot100 Рік тому

    This is an amazing explanation!

  • @herrypapaiya694
    @herrypapaiya694 3 роки тому +1

    Very helpful.

  • @abrahamnaula
    @abrahamnaula 4 роки тому +8

    Wow I ask myself why can't we get explanations like these in our educational institutions.

  • @zeeshansalim931
    @zeeshansalim931 4 роки тому

    Thats the most perfect way a guy could have explained that

  • @awaist_tauqir
    @awaist_tauqir 3 роки тому +1

    Are u alive it's been 8 years

  • @mostafagohar5534
    @mostafagohar5534 4 роки тому

    Thank you. Very Clear Explaination.

  • @DTX_
    @DTX_ 7 років тому +1

    Thanks for the video, really helped. Very well explained!

  • @aniec07
    @aniec07 11 років тому

    Superb, thanks for explaining so lucidly!

  • @alejandrodoe9168
    @alejandrodoe9168 10 років тому +1

    Awesome video dude, very understandable!

  • @NehadHirmiz
    @NehadHirmiz 9 років тому +1

    This is wonderful. Thank you very much

  • @AndriyLinnyk
    @AndriyLinnyk 11 років тому +1

    CLEAR, NICE, TO THE POINT.
    thank you ReelLearning.

  • @tmkaplan94
    @tmkaplan94 5 років тому +1

    wow, this explanation is perfect!

  • @tommarazzo5807
    @tommarazzo5807 8 років тому +1

    Can you do an extension video to this for the MOVE CONSTRUCTOR and the MOVE ASSIGNMENT OPERATOR? This video really helped me out but now we've added these extras as the Rule of 5.

  • @fahadnaim5099
    @fahadnaim5099 7 років тому

    awesome video, super explanation.... i like it bro , thanks....

  • @MangoChocobo
    @MangoChocobo 9 років тому +2

    Thank you so much for these Tutorials!

  • @WowplayerMe
    @WowplayerMe 10 років тому

    Awesome video, the explanations are perfect!

  • @sheldonchen8933
    @sheldonchen8933 5 років тому

    Good to have this video in my life.

  • @abugslife2461
    @abugslife2461 4 роки тому +3

    Thank you so much!! It's starting to make sense, but my brain still feels so fried :/ ugh okay just gonna do some more practice lol

  • @pfever
    @pfever 9 років тому +2

    This is great! Thank you!

  • @satwaghole
    @satwaghole 11 років тому +1

    Awesome video...understood obscure concepts like shallow copy , deep copy , copy constructor and assignment operators. also when to use them..very worth video.expecting more such videos on complicated concepts in C++.Thanks.

  • @amanuel2135
    @amanuel2135 8 років тому +1

    Oustanding Explanation. (period)

  • @wenhuifan9852
    @wenhuifan9852 5 років тому

    It's very clear! Thank you! What' s the link for next video! can't find it!!

  • @TheRainHarvester
    @TheRainHarvester Місяць тому

    I have a vector of vector of struct.
    The struct has pointers.
    I want to make operator= do a deep copy.
    But the operator= isn't getting called when i do:
    vecVecStruct1 = vecVecStruct2;
    Any idea why? Is this supposed to work?

  • @xc5838
    @xc5838 4 роки тому +2

    Everything was so clear. Thank you.

  • @zingg7203
    @zingg7203 8 років тому

    by depending on data members, you mean dynamic allocated variables?

  • @degenerategambler000
    @degenerategambler000 8 років тому +5

    Sir thanks for the video , you're awesome !

  • @RezaAP
    @RezaAP 11 років тому

    finally a nice tutorial with no indian accent

  • @mydream8934
    @mydream8934 4 роки тому

    what if we create a class called Tools and we define a copy constructor and operator there and then create a Tools object inside Character. Do we need to define the copy constructor and operator for Character in this case? Also, what if I've got a pointer as a reference (I'd store it as & but then I'd need to set it in a ctor and I want to set it in a function not the ctor, so it ended up being the pointer)? I do not delete this pointer, because it is handled somewhere else I do not use new on it, just as the reference. Do I still need the copy ctor and operator?

  • @CrispixKingdom
    @CrispixKingdom 9 років тому +1

    Excellent

  • @willptacek4807
    @willptacek4807 5 років тому

    BLESS UP FOR THIS VIDEO

  • @Ptr-NG
    @Ptr-NG 5 років тому

    How to overload the obj "cout" using the operator "!=" ?

  • @prvnpn216
    @prvnpn216 11 років тому

    Nice Presentation, i wonder which tool have you used to make it. Please if anyone can tell

  • @loveusoc
    @loveusoc 6 років тому

    Last video 5 years ago? I hope all is well with you! Great vids

  • @Byynx
    @Byynx 2 роки тому

    In this case you haven't used the 'new' keyword so Tool * toolArray is in the stack right ?

  • @anupamchoudhary7863
    @anupamchoudhary7863 10 років тому

    good one

  • @jrwarfare
    @jrwarfare 7 років тому

    Great video now I understand

  • @puneetsohi
    @puneetsohi 11 років тому

    Nicely done!

  • @thenetanel1996
    @thenetanel1996 7 років тому +1

    thanks man great video

  • @flynnfoil
    @flynnfoil 9 років тому +2

    Why not just not use a pointer?

  • @shinyderk
    @shinyderk 4 роки тому

    really helpful

  • @MoodFaka
    @MoodFaka 11 років тому

    that was owesome man! thanx.

  • @patriotswdk4052
    @patriotswdk4052 2 роки тому

    Grate whay to explain. You shoud work in education learning teachers/profesors how to explain programing rules ! GJ

  • @joeyodr
    @joeyodr 9 років тому

    Very helpful thanks!

  • @Jman008ful
    @Jman008ful 10 років тому

    Awesome!

  • @elfeLrOuNd
    @elfeLrOuNd 8 років тому +1

    i cant stand awful voices, not only yours is great but it was super well animated

  • @Bliss..
    @Bliss.. 10 років тому

    Thank You !

  • @arun26cs
    @arun26cs 6 років тому

    nailed it !! tnx

  • @fourleafpoker9102
    @fourleafpoker9102 7 років тому

    Thank you. :)

  • @Voltra_
    @Voltra_ 7 років тому

    I don't recommend overloading the = operator, if a user wants to copy the object pointer he should always be able to do it

    • @dirkdeklerk325
      @dirkdeklerk325 7 років тому

      Operator overloading would apply to the class level. It simply deep copies an entire object. This is different to pointing different pointers to a specific class. You can still assign the value of one pointer to another and still implement operator overloading. The two shouldnt really influence each other

  • @haryan1627
    @haryan1627 6 років тому

    thank you)*

  • @reyhandanurahman9126
    @reyhandanurahman9126 8 років тому

    best!

  • @bradleymorgan5636
    @bradleymorgan5636 7 років тому +13

    Plz update to old school runescape and Get nicer weapons lol

    • @HazardLabz
      @HazardLabz 7 років тому +2

      I specifically looked @ the comments to see if someone would mention osrs.

  • @siddighydiallo3565
    @siddighydiallo3565 5 років тому

    Bucky for sure

  • @hyorkim11
    @hyorkim11 11 років тому +1

    rule of 3 in c++: OCD

  • @544608
    @544608 6 років тому

    Real solution: use std::vector

    • @TheRainHarvester
      @TheRainHarvester Місяць тому

      I have a vector of vector of struct.
      The struct has pointers.
      I want to make operator= do a deep copy.
      But the operator= isn't getting called when i do:
      vecVecStruct1 = vecVecStruct2;
      Any idea why? Is this supposed to work?