Using the Autos window. Start the debugger by selecting
Debug >
Start. When the debugger enters break mode at line 14, open the
Autos window (Fig. G.22) by selecting
Debug > Windows > Autos. Since we are just
beginning the program's execution, the
Autos window lists only the variables in the next statement that will execute—in this
case, the
account1 object, its value and its type. Viewing the values
stored in an object lets you verify that your program is manipulating these
variables correctly. Notice that
account1 contains a large negative
value. This value, which may be different each time the program executes, is
account1's uninitialized value. This unpredictable (and often
undesirable) value demonstrates why it is important to initialize all C++
variables before they are used.
No comments:
Post a Comment