First I want to put it out there that yes this is homework and no I'm not asking for it to be done for me :) For my assignment I have to create a class that simulates blocks of memory. I have to write a few member functions and overload some operators. I have +, == and = working as they should but am having some problems with some other aspects of the assignment.
I am tying to overload the << operator. I am having some trouble with it and every example I can find online shows it as a friend function. I haven't seen it as a member function and I haven't figured it out yet so I am not sure how to proceed. To my understanding, a member function needs exactly one argument. I guess if anyone could point me to an example or an example of just the function signature that would help. Thanks for reading.
> To my understanding, a member function needs exactly one argument
Nope, if it is a binary operator then the `left' operand is this (the object that makes the call)
so the signature just ask for one argument.
> I probably screwed up somewhere
Likely, if you show what you did we may help.
Ok that's how I was going to do it originally but then I reread the assignment and it said member functions so that's how I was trying to do it.. So I guess my next question is how would I output an array in that way? If it was say a point I could just do something like this I think:
ostream &operator<<( ostream &o, const Point &p) {