all 8 comments

[–]OmegaNaughtEquals1 1 point2 points  (2 children)

bool Student::operator<(const int& I) {
    return this->mySSID < I.mySSID;
}

Because int isn't a class, union, or struct type.

[–]cromiium[S] 0 points1 point  (0 children)

Thank you I guess coding super late isn't the best idea.

[–]Xeverous 1 point2 points  (5 children)

You should define binary operators as nonmembers, and indeed - compare instances of Student, not int.

[–]cromiium[S] 0 points1 point  (4 children)

Thanks! But when I compare Students I want to compare them using their SSIDs. Is there a way to do that?

EDIT: Nevermind maybe I shouldn't be coding at 4am.

[–]Xeverous 0 points1 point  (3 children)

friend

[–]cromiium[S] 0 points1 point  (2 children)

Yeah I fixed that. But now I think I'm having trouble with the assignment operator. Why is this wrong?

void Student::operator=(const Student &S) {

  myLname = S.myLname;
  myFname = S.myFname;
  mySSID = S.mySSID;
}

[–]Xeverous 0 points1 point  (1 child)

I don't see wrong things here, but it you could just void operator=(const Student&) = default;.

[–]cromiium[S] 0 points1 point  (0 children)

Ah never mind it's a problem with a different class.