first vid that actually explains each of the keywords and symbols for the operator overload instead of just writing the overload with no further elaboration.
Dear bro, I just did it the get line overload and it works. Thank you bro. I just started learning C++ by watching your tutorials. Yeahhhhh istream& getline (istream &input,User &user) //extration operator syntax getline(note: reference at object) { getline(input,user.first_name); getline(input,user.last_name); return input; }
I had to go over this a couple times, which was well worth it, as I walked away with an understanding of operator overloading, rather than to put it off until later. Yet another tool in the arsenal in the C++ language thanks to Caleb Curry's tutorial. Thank you, sir.
For people who got the error "Too many parameters for this operator function" Declare the function in the class as a friend, and then define the function outside of the class. Example: class Position { public: int x = 10; int y = 20; friend std::ostream& operator
How do we overload insertion and extraction operators as a member function inside a class? This explanation works wonderful, but when I try to put it as member function in a class, it says that there is no match for the operator
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?
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
first vid that actually explains each of the keywords and symbols for the operator overload instead of just writing the overload with no further elaboration.
thank your for this, I didn't really know what my teacher was teaching until this
Sad reality
Dear bro, I just did it the get line overload and it works. Thank you bro. I just started learning C++ by watching your tutorials. Yeahhhhh
istream& getline (istream &input,User &user) //extration operator syntax getline(note: reference at object)
{
getline(input,user.first_name);
getline(input,user.last_name);
return input;
}
This tutorial series is great I have been following along since the first tutorial and I learned a lot.
I had to go over this a couple times, which was well worth it, as I walked away with an understanding of operator overloading, rather than to put it off until later. Yet another tool in the arsenal in the C++ language thanks to Caleb Curry's tutorial. Thank you, sir.
You made it as easy as a piece of cake for me as a beginner.
liked and subscribed.
Actually you can use previous example:
Position y;
y.y = 5;
cout
This is gold.
Extraction? More like extraction of ignorance, and replacement with knowledge! Thanks again so much for this wonderful tutorial series.
For people who got the error "Too many parameters for this operator function"
Declare the function in the class as a friend, and then define the function outside of the class. Example:
class Position
{
public:
int x = 10;
int y = 20;
friend std::ostream& operator
Thanks a ton
Ok, but why does that work?
How do we overload insertion and extraction operators as a member function inside a class? This explanation works wonderful, but when I try to put it as member function in a class, it says that there is no match for the operator
Great video! Thanks a lot!
This was actually less confusing than the previous video.
It's the opposite for me.
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?
Great stuff
I see another example in my school,
as public member of class _____ void operator
i have a question, is there any way to return ostream without returning reference, i kno this is useless but i just wanna kno
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
@@brandonmeeker6377 Thanks
please explain layman term in insertion and extraction overloading , kindly i can't understand .please listen my voice.
Have a question : why would i use this instead of adding a method to print out each object?
One of the reasons is a cleaner code.
Why can't we do copies of the ostream? I know it's bad practice but would it even be possible?
2:44
I tried the input without returning anything (with a void type) and it worked. Is it supposed to be done like I did?
@@brandonmeeker6377 best answer to that specific question I've seen.