KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Single inheritance is easy to implement. For example, in C, the inheritance can be simulated as: struct Base { int a; } struct Descendant { Base parent; int b; } But with multiple inheritance, the compiler has to arrange multiple parents inside newly constructed class. How is it done? The problem I see arising is: should the parents be arranged in AB or BA, or maybe even other way? And then, if I do a cast: SecondBase * base = (SecondBase *) &object_with_base1_and_base2_parents; The compiler must consider whether to alter or not the original pointer. Similar tricky things are required with virtuals.
Tags (comma-separated)
Save Edits
Cancel