Exercises in this lecture   previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Go to the notes, in which this exercise belongs -- Keyboard shortcut: 'u'   Alphabetic index   Course home      

Exercise 7.8
Casting of BankAccounts


In the program "An illustration of type casting (C)v" the static types of the variables baRes1 .. baRes6 are BankAccount. Now change the static types of the variables baRes1 .. baRes6 to CheckAccount. This is done simply by declaring baRes1 .. baRes6 as CheckAccounts.

Predict the compilers reaction before you attempt a compilation of the modified program.

Afterwards compile the program and confirm your predictions.


Solution