Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With this declaration, SOMETHINGS[1], etc. can be modified by clients of the code.

This noncompliant code example also violates OBJ01-J. Limit accessibility of fields.

Compliant Solution

One approach is to have a private array and a public method that returns a copy of the array:

...