O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required