Buckys C++ Programming Tutorials – 50 – Operator Overloading

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

39 responses to “Buckys C++ Programming Tutorials – 50 – Operator Overloading”

  1. pzg2008 Avatar

    "I like it right up there"

  2. Banjo Avatar

    y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆
    y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆y̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̰̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆̆

  3. Glenn Lopez Avatar

    Thanks, it is less confusing for me now.

  4. code lover Avatar

    can someone tell me when to initialise the argument value and when to not?

  5. Towni Eyan Avatar

    I don't see why anyone may find this confusing! If you don't understand the purpose of operator overloading, go look it up before you watch this tutorial.

  6. Game Emperor Avatar

    I'll try to make it one thing simple:

    Keep in mind when you make a class you should make an objects right?
    So whenever you create 2 objects they are different

  7. רז אש Avatar

    this is the code I saw:
    sally::sally sally sally sally::sally (Sally,Sally)Sally=Sally;

  8. Amit Kr Das Avatar

    idiotically explained

  9. Emir Jusic Avatar

    hi, how to overload operator [ ]  for 2d  c array without allocating memory and pointers ? thanks

  10. Zero H Avatar

    UGH, geez, ok so this is for adding 2 sally objects together, but if you wanted to add say an integer to a sally object you can also do that, so you can overload the function with an integer object too, and follow his steps, you can give the operators more versatility as well as intuitive returns. The tutorial isn't that bad, but definitely cut short.

  11. Learn BY Watch Avatar

    this video is really disappointed…

  12. Silver Mirai Avatar

    In the code bellow, from sololearn, how does the function know that this->var reffers to obj1.var, and obj.var as in obj from the parameter refers to obj2.var ?
    It's very confusing, I don't understand the syntax's logic.

    class MyClass {
    public:
    int var;
    MyClass() {}
    MyClass(int a)
    : var(a) { }

    MyClass operator+(MyClass &obj) {
    MyClass res;
    res.var= this->var+obj.var;
    return res;
    }
    };

    int main() {
    MyClass obj1(12), obj2(55);
    MyClass res = obj1+obj2;

    cout << res.var;
    }

    //Outputs 67

  13. violinsheets Avatar

    AVOID THIS VIDEO!!!!!!! This is literally the worst possible explanation of operator overloading and there are so many bugs in his code.

  14. Rem waifu Avatar

    all these noobs commenting their complaints. hes not adding two numbers together BUT two OBJECTS that contain numbers! if you do sallyobj +sallyob2 it doesn't equal anything and will give you an error so you define the + operator for when you do that to make c++ understand what your doing. If you find it confusing do it yourself and add comments, dont just watch and complain but actually do it! This is programming welcome.

  15. Slav Slavko Avatar

    The best video about operator overloading. People mainly explain this through too complicated examples.

    This is completely understandable and clear.

  16. Rifatul Karim Avatar

    Why that "Sally" name has too much to do with C++?
    Why did you ended abruptly? – DISLIKE button pressed!

  17. TrueRattlehead Avatar

    Different day different girl

  18. Nitin Sharma Avatar

    Didnt get anything. Way too confusing

  19. romanemul1 Avatar

    dislike. Even i understand the concept .This was confusing. Didnt even watched till the end.

  20. Jerkwaad Avatar

    abrupt end :O :O

  21. Ayush Pandey Avatar

    this was the most confusing video of yours.

  22. Karla Barraza Avatar

    Thanks! This really helped me out.

  23. 12tare21 Avatar

    i don't know if it is bad programming practice but i find out easier
    solution than operator overload:

    Sally Sa1(2);
    Sally Sa2(3);
    Sally Sa3(Sa1.num+Sa2.num);
    cout<<Sa3.num<<endl;

    So it will output "5",and you don't have to write any function for
    that,or maybe you just used this for an example and operator overload
    has much wider use in some more complex programming

  24. saipavan koppu Avatar

    iam using devc++ and iam unable to open file<class to create a new class?
    what to do?

  25. Chad Drake Avatar

    This is way to confusing. Use different names. And keep your classes and main in the same program.

  26. abir ishtiaque Avatar

    You used 'Sally' way too many times in this video :

  27. HowToCompute Avatar

    Is it just my YouTube or did the video just suddenly randomly end?

  28. Seema Pradhan Avatar

    The first video of yours that I did not understand. Problem might be in your example. Please find a simpler example

  29. steve122288 Avatar

    interesting that if you attempt to overload an operator but give it no parameters, it will compile but it will will give you an error if you call it using the intended operator. It will only work if you use the dot operator to call it like it is a regular function name. It must be doing something however, as you cannot otherwise have operators or keywords as part of a function name.

  30. 9hsn3 Avatar

    is there a way for example to make class and overload it with passing to it a value

    for example:

    class sally{
    private:
    int x[5];
    public:
    void set_element(int x, int value);
    }

    so i can set
    x[4] through this
    saly.set_element(4,value)

    however i want somthing like i assign value through = operator

  31. LoneC Avatar

    How would this be useful, i dont understand?

  32. Gaurav Desale Avatar

    Why do he use the num = a instead of using num(a)? what is the difference between them?

  33. Saurabh Banore Avatar

    Great work Bucky !!!

  34. 乃木ボーイ Avatar

    why the fuck did u always use fucking weird syntax

  35. Gavin Hoang Avatar

    can not understand. i am sally (sadly)……

  36. Persian771 Avatar

    Hmm that's hard to understand specially with that :: thing the only thing I know about it is resolution operator which you talked about in another video but don't know what :: does in this video.and I also don't know about making class and header.

  37. Galluxi Avatar

    U SAID that no variables in public…

Leave a Reply

Your email address will not be published. Required fields are marked *