ApexSensei

Drills Classes & objects

Overload a Case label method

Overloading is one method name with different parameter lists; Apex picks the version whose parameters match your call.

Your task

Overload a Case label method so each parameter list handles normal, urgent or aged Cases.

class CaseLabeler {
    public String label(String subject) {
        return null;
    }
}

Requirements

  1. label(String, Boolean) should be present
  2. label(String, Integer) should be present
  3. Default: Normal: Password reset should be printed
  4. With flag: Urgent: Data loss should be printed
  5. With age: Aged: Pending refund should be printed
  6. label('Pending refund', 6) should be Normal: Pending refund
  7. label('Printer jam', false) should be Normal: Printer jam

Sign in to open this drill