I am pretty sure I understand the general difference between upcasting and downcasting, particularly in C++. I understand that we can't always downcast because casting a base class pointer to a derived class pointer would assume that the base class object being pointed to has all the members of the derived class.
Early in the semester, my professor told the class that it is also sometimes illegal to upcast in C++, but I seem to have missed the reason why in my notes, and I can't remember when this occurs.
When is it illegal to upcast in C++?
If by "illegal" you mean ill-formed, then it is illegal if the base class is inaccessible or ambiguous.
It is inaccessible when, for example, the base class is private.
Note that even in C++11 a C-style cast can "break through" access protection and perform a formally correct upcast
This usage should be avoided, of course.
It is ambiguous if your source type contains multiple base subobjects of the target type (through multiple inheritance).
In such cases the upcast can be performed by explicitly "walking" the desired upcast path with intermediate upcasts to the point where the base is no longer ambiguous