Mar 18, 2015 at 2:05pm UTC
I'm kind of confused by this one question.
WHich of the functions implementing operator overloading is not valid. I'm kind of confused by the jargon usage. I'm pretty sure its the first one correct?
The list is:
1. ostream& operator<<(ostream& os, Month m)
2.int operator +(int,int)
3.Vector operator +(const Vector& const Vector&)
4. Vector operator += (const Vector& int);
Mar 18, 2015 at 2:24pm UTC
Thats not function overloading, thats operator overloading.
Im not super familiar with them but Ive used them before.
The first one looks valid.
The rest are invalid.
Mar 18, 2015 at 3:02pm UTC
I believe 4 should take 2 parameters and return a ref.
it would be valid declared as a member, but none of the other examples are, so thats the one for me.
Mar 18, 2015 at 3:51pm UTC
YEah I know its kind of a hard question isn't it. Its either 3 or 4.
Mar 18, 2015 at 5:48pm UTC
You have to make sure that you don't have any typo's here OP. Make sure you didn't miss any comma's or semi-colons.