Description
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.
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 are disallowed with dynamic_cast, and some are disallowed with static_cast.
What to turn in:
Turn in a directory named after your userid. In a subdirectory named 1, put the answers for Part 1 in this. It can be photographs or one or more .pdf files. In a subdirectory named 2 put the code using static_cast and dynamic_cast. Note that only the file with the main function changes. It is expected that the code in directory 2 will have compile time or run time errors caused by the casts.
Zip up the director and turn it into Brightspace.
Grading:
4 points for the VFT
3 points for showing what entries are used by statements
3 points for programs using dynamic and static casts
Reviews
There are no reviews yet.