Operator Overloading in C++ Example 2 | C++ Tutorial | Mr. Kishore

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

КОМЕНТАРІ • 94

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

    Please Comment, Subscribe and Click Bell🔔🔔🔔 Icon for More Updates. To learn software course from our experts please register here for online training: goo.gl/HIB0wL

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

      Is this normal operator overloading is also called binary operator overloading, right? I just want to confirm🙂 plzz sir reply
      And thanks for this amazing explanation 🙂

  • @queensheba693
    @queensheba693 4 роки тому +20

    Best teacher of c++ I have ever seen. Thank you so much sir 🙏

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

    Best explanation for + operator overloading on youtube. thank you so much.

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

    Eventhough taking more time... repeating and enforceing every point again and again gets into our head open our mind... this is super sir and ur teaching is too good..God bless you... thank you

  • @aumkhant5215
    @aumkhant5215 4 роки тому +4

    We can also add two strings using string data type directly.
    Eg. String s1,s2,s3;
    s3=s1+s2;

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

      we know that operators works only with predefined data types. In C++ this operator overloading concept is defined to work with user-defined data type. Please note that string is predefined data type but objects are user defined and we are adding two objects. So we can't directly add them.

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

      @@sunitakanharkar1542 I am telling that we can use string instead of char array in this problem!!

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

      @@aumkhant5215 The objective (focus) here is to see how operator overloading works. Most of the programmers already know we can do string addition directly.

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

      @@fxexile yes bro I agree with you

  • @NithyaShree-lv3my
    @NithyaShree-lv3my 8 місяців тому +1

    the most underrated channel on youtube!!great lectures!!

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

    Definitely one of the best teachers of c++ ,all while using a whiteboard!? Much respect to you sir!

  • @kickflicks9683
    @kickflicks9683 5 років тому +2

    Best channel and best lecturer in the UA-cam....thank you sir

  • @speedyrax4506
    @speedyrax4506 Рік тому +1

    this lecture is the best because of the board...... everything shown in codeblocks goes over my head.... wish i had you as my teacher...

  • @ajaykharat8689
    @ajaykharat8689 6 років тому +3

    #include
    #include
    #include
    using namespace std;
    //operator overloading is using existing operator on user defined datatype(Object,Structure) instead of function or similar to function
    //existing operator(+,/,*,) operates on pre-define datatype(int, float, char) now using operator overloading existing operator operates on user define datatype (Object, Structure)
    //Always L.H.S object must be implicit object of same class and R.H.S object must be explicit. This rule is true for both 1. using function 2. using operator overloading.
    class ajay
    {
    int a;
    public:
    void getdata()
    {
    couta;
    }

    void add(ajay a2)
    {
    cout

    • @karthikeyan-lv6wu
      @karthikeyan-lv6wu 4 роки тому

      good but it is simple addition u made it more complicate.
      matrix addition is best one for + operaor
      M3 = M1 + M2;
      where M1, M2 are matrices.......................

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

    you are the only one in the entire youtube who has explained this concept well. Thank you

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

    Great explanation.. thanks a lot sir for free online classes... Even paying classes also not like these classes 🙏🙏🙏🙏🙏👍👍👍👍

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

    1 number ...........sir........osm.........................

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

    In depth Explanation.....Nice teaching sir

  • @jockergaming6853
    @jockergaming6853 9 місяців тому

    i was struggling to under this concept but your two video made this cystle clear

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

    you are a good teacher ..sir

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

    excellent explanation

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

    Thank you sir. Your explanation is very clear

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

    thanks a lot, you are perfect as usual, even without computered explanation

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

    Thank u so much sir. Very clear explanation

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

    Very nicely explained

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

    Thanku sir you are simply great

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

    Great explanation 👍👍..

  • @sahdevchandraswarnakar4549
    @sahdevchandraswarnakar4549 6 років тому +1

    You are great,,, Sir

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

    Thank you to kishore sir and naresh technologies

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

    Amazing Sir

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

    excellent explanation sir!!😁

  • @madhukumars458
    @madhukumars458 6 років тому +1

    I got the clear cut difference between implicit and explicit objects

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

    Excellent Sir

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

    Its awesome...:) clearly understood.

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

    jatt da ni muqabla
    sirra teacher

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

    Salute sir

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

    Good explanations sir.

  • @ГерриПитт
    @ГерриПитт 5 років тому

    Thanks for the videos!

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

    Great Explanation!

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

    Thank you sir 🙏

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

    Well explained!, Please keep uploading more vedios sir

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

    Very nice

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

    Outstanding

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

    A builder started the construction of their two buildings on the same day and completed at different day. Develop an OOP to perform the comparison on their completion date and find the earlier completion date and later completion date by overloading the < and/or > operator. Assume the difference between the two completion dates may be more than a year.
    Need ans plsss

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

    Super sir.

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

    good explanation sir

  • @basudevnath7977
    @basudevnath7977 6 років тому +1

    Sir pls demonstrate how to overload new and delete operator

  • @riturajanand7133
    @riturajanand7133 5 років тому +2

    sir if I use 2 strcpy() and 1 strcat() then I don't get desired result i.e both string will not get copied

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

      How u are using copy fcn... n concatenation fcn

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

      exactly bro same problem have u resolved it ???

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

    seriously ur super

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

    what does implicit and explicit object means??

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

    can we take object in number fucction because t3 is declared in function right

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

    Thanks

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

    Here in operator declaration we're using (Test T2) and while Calling the main fiction the object T1 is not assigned how will the compiler consider T1 as implicit value in operator definition?

    • @vsarts1967
      @vsarts1967 4 роки тому +6

      This is a rule.always L.H.S object must be implicit object of same class and R.H.S object must be explicit.(valid for using function ,using operator overloading )

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

      Are you aware about "this" pointer?

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

      The compiler takes it this way :
      In add function argument
      Test add(test t2) :
      Test t3 = this->st + t2.st;
      Where "this" is the pointer to the calling object.

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

    numbering the lessons serially will help those wishing to learn systematically... can we look forward to numbered lessons

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

    Sir can't we define a sum function and call it in main function by t3.sum()?
    please do reply

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

      But what are you exactly adding in the sum function?
      Because you haven't passed any argument , you are just calling the function for the object t3. Could you be more specific?

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

    give example of adding three or more objects

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

    Can anyone tell me why it is giving error at test t2

  • @sonu-uq1um
    @sonu-uq1um 6 років тому

    hello sir
    can you upload the videos of java

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

    Sir i think you have experience of 20 to 25 year of teaching😇😇😇😇😇😇

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

    add function overloading sessions sir

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

    why don't we need to overload "="operator in t3=t1+t2; statement

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

      assignment operator '=' works for objects.There is no need to to overload '=' operator for objects. It will copy the contents of t1+t2 to t3 data member by member

  • @7sinsganiftw877
    @7sinsganiftw877 2 місяці тому

    why dont he use string data type directly when we have string data type in c?

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

    when i tried to print the string it is printing only second sting but not first .can anyone please help me

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

      if you follow his step ..it will definitely works ..please check the code once

    • @suhailsama5195
      @suhailsama5195 Рік тому +1

      bro you are using strcpy function in strcat i am doing same

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

    fk maza agya

  • @ajaykharat8689
    @ajaykharat8689 6 років тому +10

    #include
    #include
    #include
    using namespace std;
    //operator overloading is using existing operator on user defined datatype(Object,Structure) instead of function.
    //existing operator(+,/,*,) operates on pre-define datatype(int, float, char) now using operator overloading existing operator operates on user define datatype (Object, Structure).
    //Always L.H.S object must be implicit object of same class and R.H.S object must be explicit. This rule is true for both 1. using function 2. using operator overloading.
    class ajay
    {
    int a;
    public:
    void getdata()
    {
    couta;
    }

    void operator +(ajay a2)
    {
    cout

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

    Thank you very much sir for your nice explanation!

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

    Amazing Sir

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

    you are great sir

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

    Thank you 😊 .sir

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

    Thank u sir

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

    Thanks