I need to overload operator >=. If the condition is true, the operator returns true, otherwise false. If at least one of the objects is null – throw an exception (ArgumentException). I tried this. What's wrong?
public static bool operator false(Staff inputPerson) { if ((inputPerson.salary) <= 15000) { return true; } else if ((inputPerson.salary) is null) { throw new ArgumentOutOfRangeException("This person does not have a job"); } return false; }
staffA >= staffBdoesn't make any sense and it makes the code cryptic.staffA.Salary >= staffB.Salaryis a lot cleaner.