Reliable Software Logo
 Home  >  C++ Resources  > C++ In Action Book > Language: Arrays and References

C++ In Action: Language

Arrays and References

In a program, an object is identified by its name. But if we had to call the object by its name everywhere, we would end up with one global name space. Our program would execute in a structure-less "object soup." The power to give an object different names in different scopes provides an additional level of indirection, so important in programming. There is an old saying in Computer Science--every problem can be solved by adding a level of indirection. This indirection can be accomplished by using a reference, an alias, an alternative name, that can be attached to a different object every time it enters a scope.

Computers are great at menial tasks. They have a lot more patience that we humans do. It is a punishment for a human to have to write "I will not challenge my teacher's authority" a hundred times. Tell the computer to do it a hundred times, and it won't even blink. That's the power of iteration (and conformity).


  1. References
  2. Stack-based Calculator
    • Functional Specification
    • Design
    • Stubbed Implementation
    • Implementation
  3. Exercises