Internal State
The internal state of aRequest is represented by myOperator and myOperand. The functions on lines 17–35 of the implementation allow other classes or code to get those values.
If you refer back to Figure 18.2 in Lesson 18, “Refactoring the Calculator with Classes,” you will see that not all classes have internal state. For instance, anExternalInterface has no member variables at all.
Instances of classes such as aRequest have a single internal state for their entire life span, because their member variables cannot be changed.
Instances of classes such as anAccumulator have an internal state that changes frequently. Every call to Apply() changes the internal state of anAccumulator.
Instances of classes such as aController have an ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access