invariant abstract method

bool invariant()

The invariant condition that must always be true for this object.

Subclasses must override this to define their invariants. Should return true if the object is in a valid state, false otherwise.

Example:

@override
bool invariant() {
  return _size >= 0 && _size <= capacity;
}

Implementation

bool invariant();