What is the result of attempting to compile and run the above program?
the answer is that it compiles fine. In the explanation, Dan writes... "Although line 12 appears to be the source of a compiler error it is not. In line 12, the reference named base actually refers to an object of type Sub. Therefore, the reference to the object may be cast to type Sub. " Now, if base was actually an object of type Base, i thought it might stil be okay, as there is an explicit cast to the type of Sub? [Dan added the UBB codes to format the code block.] [ March 07, 2003: Message edited by: Dan Chisholm ]
so...the only reason for the explicit cast is because... um, well, i guess, maybe it isn't required? No, it probably is, because although base refers to an obj of type Sub, the actual reference variable is of type Base?