C++ Programming Tutorial 94 – Overloading Insertion and Extraction Operators

NOW OPEN! Python Bootcamp – https://www.codebreakthrough.com/python-bootcamp

💯 FREE Courses (100+ hours) – https://calcur.tech/all-in-ones
🐍 Python Course – https://calcur.tech/python-courses

✅ Data Structures & Algorithms – https://calcur.tech/dsa-youtube

~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

✉️ Newsletter – https://calcur.tech/newsletter
📸 Instagram – https://www.instagram.com/CalebCurry
🐦 Twitter – https://twitter.com/calebCurry
🔗 LinkedIn – https://www.linkedin.com/in/calebcurry
▶️ Subscribe – http://calcur.tech/subscribe
👨🏻‍🎓 Courses – https://www.codebreakthrough.com

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

↪ My Amazon Store – https://www.amazon.com/shop/calebcurry
🅿 Patreon – http://calcur.tech/patreon-calebcurry
🅖 GitHub Sponsors – https://github.com/sponsors/CalebCurry
Ⓟ Paypal – http://paypal.me/calcur

🅑 Bitcoin – 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth – 0x350139af84b60d075a3a0379716040b63f6D3853
📈 Buy Bitcoin – https://calcur.tech/crypto
Reserve the Ruby Steel crypto rewards card and get a $25 bonus (use affiliate code “Caleb”) – https://calcur.tech/crypto

source by Caleb Curry

c++ programming

Mourad ELGORMA

Mourad ELGORMA

Fondateur de summarynetworks, passionné des nouvelles technologies et des métiers de Réseautique , Master en réseaux et système de télécommunications. ,j’ai affaire à Pascal, Delphi, Java, MATLAB, php …Connaissance du protocole TCP / IP, des applications Ethernet, des WLAN …Planification, installation et dépannage de problèmes de réseau informatique……Installez, configurez et dépannez les périphériques Cisco IOS. Surveillez les performances du réseau et isolez les défaillances du réseau. VLANs, protocoles de routage (RIPv2, EIGRP, OSPF.)…..Manipuler des systèmes embarqués (matériel et logiciel ex: Beaglebone Black)…Linux (Ubuntu, kali, serveur Mandriva Fedora, …). Microsoft (Windows, Windows Server 2003). ……Paquet tracer, GNS3, VMware Workstation, Virtual Box, Filezilla (client / serveur), EasyPhp, serveur Wamp,Le système de gestion WORDPRESS………Installation des caméras de surveillance ( technologie hikvision DVR………..). ,

9 réflexions sur “C++ Programming Tutorial 94 – Overloading Insertion and Extraction Operators

  • Avatar
    avril 19, 2021 à 10:06
    Permalien

    The second parameter of extraction overloading function is passed by reference.
    Does this mean that the reference allows us to change an user object to another?

    Répondre
  • Avatar
    avril 19, 2021 à 10:06
    Permalien

    This tutorial series is great I have been following along since the first tutorial and I learned a lot.

    Répondre
  • Avatar
    avril 19, 2021 à 10:06
    Permalien

    I tried the input without returning anything (with a void type) and it worked. Is it supposed to be done like I did?

    Répondre
  • Avatar
    avril 19, 2021 à 10:06
    Permalien

    Actually you can use previous example:

    Position y;
    y.y = 5;
    cout << "What the new value of Y"<<endl;
    //Compiler know how to insert y value to y
    cin >> y;
    //y is updated to user input value
    cout << y << endl;
    really like your explanation

    Répondre
  • Avatar
    avril 19, 2021 à 10:06
    Permalien

    When I add in User into the operator overloading function parameter, I get the error "too many parameters for this operator function", but when I add it in a friend, this error goes away. Can someone explain why this is happening?

    ostream& operator << (ostream& output, User user){
    return output;
    }

    This is not compiling

    Répondre
  • Avatar
    avril 19, 2021 à 10:06
    Permalien

    Another way of doing the istream operator overload:

    istream &operator >> (istream &input, User &user)
    {
        cout << "What should " << user.first_name << user.last_name << "'s new first name be?";
        input >> user.first_name;
        cout << "What should " << user.first_name << user.last_name << "'s new last name be?";
        input >> user.last_name;
        cout << "What should " << user.first_name << user.last_name << "'s new status name be?";
        string temp_status;
        input >> temp_status;
        user.set_status(temp_status);
        return input;
    }

    Répondre

Laisser un commentaire