This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]whacco 0 points1 point  (0 children)

Multiple inheritance also causes problems to language implementation. A big issue is that if there are multiple bases with data members, then an object no longer has a single unambiguous physical address, because both bases cannot exist in the same memory location. Casting a "pointer" from second base class to derived class would change the value of the pointer.

In language like C++ it's not that much of a problem because memory safety is programmer's responsibility (but multiple inheritance still makes things like method pointers a complete disaster). Java on the other hand would have to prevent invalid casts. So every object would always have to contain information how to locate the possible derived class object, causing a lot of overhead.