The provided program is an illegal C++ program. C++ cannot always tell when a program is illegal, and in that case, it will compile the program but the behavior will be undefined and dependent on the combination of the processor, OS, compiler and so forth. What is done in this program should never be done by you.
VFTs for the different classes are provided in a .pdf called VFT.pdf. Label VFT entries with the statement number (shown in the code, S1 through S5) of the call(s) in main.cpp that use them. The S0 call is shown as an example. You may do your drawings by hand and scan or photograph the sheet to turn in. Note any strange behavior and explain it to yourself in terms of the VFTs, but you dont need to write this and turn it in.
Make a different copy of main.cpp called mainStaticCast.cpp and mainDynamicCast.cpp and turn the Cstyle casts into static_cast and dynamic_cast, respectively. Observe how all of the illegal assignments in the original program
Reviews
There are no reviews yet.