   multiple inheritance as interface
  I been implementing an series of ODE integrator for a game I''ve been working on with some friends.Personally I don''t want the integrator object to know about the objects it is integrating for, more than absolutely necessary, thus the physics object inherit from another class called integratable which has a pure virtual function called derive (provide the derivative of the vector elements) and no data members.This is basically how java does their interface but I was wondering what are the performance cost of the two and whether will the multiple inheritance be too expensive to use for this purpose? 
  How expensive this is would be compiler as well as usage dependent. Most implementations of multiple inheritance work by aggregating separate copies of base objects as "members" of the derived objects and adding either a base object offset to entries in the vtable or directing vtable entries to a thunk. If you use simple interface style abstract classes as base classes, this usually just adds an extra vtable pointer to the derived class. The overhead in the vtable would be paid no matter if it was a single or multiple inheritance. So, on the whole, it''s not all that expensive in the base case.On the other hand, if every class is derived from twenty different interfaces, then you might start running into some performance problems. ;quote:Original post by SiCrane  Most implementations of multiple inheritance work by aggregating separate copies of base objects as "members" of the derived objects and adding either a base object offset to entries in the vtable or directing vtable entries to a thunk.No implementation aggregates the separate copies of  base objects by default.  You must mark a base class as virtual for it to be aggregated in multiple inheritence; otherwise, each base gets its own copy of any common base class.  I''d suggest reading "The C++ Object Model".  There''s many ways that the object model could be implemented; however, most compilers today are  very close to the model specified in this book.;  I think you misunderstood my statement. I said "separate copies of base objects" not "a separate object for every base class in the hierarchy", which seems how you interpreted my remark. If anything a complaint should be leveraged in the opposite direction because my statement deliberately ignored virtual inheritance (which seemed irrelevant to the question at hand). 