Chapter 29: | How To Write Programs that Find Member Functions at Run Time |
You have already learned about programs that work with arrays of
integers, of integer pointers, of cylinders, and of cylinder
pointers. Now, you learn about
analyze_train
, a program that works with an array of
railroad-car pointers. The basic analyze_train
program
introduced in this chapter reads railroad-cartype numbers and
displays a report listing railroad-cartype names.
The analyze_train
program is a keystone program, because it brings
together many concepts, including C++'s mechanisms for reading,
displaying, testing, conditional execution, iteration, and pointer
dereferencing.
Once you have learned about the basic analyze_train
program
introduced in this chapter, you will be ready to tackle many
other C++ mechanisms, each of which is introduced in subsequent
chapters through modifications to the analyze_train
program.
Some modifications expose more sophisticated ideas, such as
inheritance through a class hierarchy and run-time function
selection using virtual functions. Other modifications
introduce commonplace mechanisms that have been skipped over so
as to expose you to C++'s strengths more quickly.