EX9_21.cpp, page 553
I am not sure, at present, whether this is a typo with a fortunate outcome or not.
The text has the following and I am querying the use of Container^ in the last of the quoted lines:
Console::WriteLine(L"Popping the items off the stack presents them in reverse order:");
Box^ item;
while((item = stack->Pop()) != nullptr)
safe_cast<Container^>(item)->ShowVolume();
Or should it be as follows?
Console::WriteLine(L"Popping the items off the stack presents them in reverse order:");
Box^ item;
while((item = stack->Pop()) != nullptr)
safe_cast<Box^>(item)->ShowVolume();
Both versions give the same answer, but I do not feel that that would always be true.
|