Path: utzoo!utgpu!watserv1!watmath!att!occrsh!uokmax!apple!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sdd.hp.com!hplabs!hpcc01!hpcuhb!hpda!hpcupt1!thomasw From: thomasw@hpcupt1.HP.COM (Thomas Wang) Newsgroups: comp.lang.c++ Subject: Multiple Inheritance flaw Message-ID: <7050013@hpcupt1.HP.COM> Date: 3 Jun 90 00:44:13 GMT Organization: Hewlett Packard, Cupertino Lines: 24 There is a serious flaw in C++'s multiple inheritance scheme. The manual reads "One can cast from a derived class to a virtual base class, but not from a virtual base class to a derived class." Normally, one would make a list class that operates on the base class. With the run-time type information, it is safe to cast to a derived class. This no longer works with multiple inheritance. The base class is usually declared 'public virtual'. So even when it is obviously safe to type cast upward, C++ still cannot do it. Reading from manual, I understand this limitation is due to the use of one way pointers. However, I wonder how much effort would be required to implement the backward pointer. Maybe we can split the vtbl into two parts. Part 1 is the function jump table indexed by function. Part 2 is the byte offset table indexed by type. This way, the base class can use the byte offset table to calculate the backward pointer. -Thomas Wang (Everything is an object.) wang@hpdmsjlm.cup.hp.com thomasw@hpcupt1.cup.hp.com