|Program-Example Part One (without multiple inheritance and virtual base-classes):
[simple single inheritance example which did downcasting]
|Program-Example Part Two (using multiple inheritance and virtual base-classes): where┤s the error?
[simple example using multiple virtual inheritance, and attempted to
downcast from a virtual vase]
|The first program-example yields the desired output ("ok") while the second one usually shuts down without any warning message. The questions is: ist there an error in the program itself or does my compiler (BORLAND C++ 3.1) have problems with virtual baseclasses and multiple inheritance.
|I am grateful for any comment (how can one solve this Problem, do other C++ compilers have similar problems, and so on..)
|
This is a problem in your code. It is illegal to cast a virtual base
class into a derived class. This is specified in the ARM 10.6c. The
reason is that the virtual base class has no way of knowing the memory
layout of the derived object. Therefore it cannot find the beginning