Jean-Marc Lasgouttes wrote: >>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes: > > Angus> It seems to me that it would be apropriate to use multiple > Angus> inheritance for insets that have a dialog. Attached is a > sample Angus> piece of code that compiles but is otherwise untested. > > Angus> * Does anyone have any experience with such a beast? * Are > Angus> there any problems I should watch out for? * Is this a good > Angus> thing to do? > > Can you tell me again what virtual inheritence of classes is? > > JMarc
Sure. Normal inheritance: class Vehicle {}; class Car: public Vehicle {}; class Trailer: public: Vehicle {}; class CarAndTrailer: public Car, public Trailer {}; Vehicle Vehicle | | Car Trailer |_______________| | CarAndTrailer Virtual inheritance: class CarAndTrailer: virtual public Car, virtual public Trailer {}; Vehicle ________|_______ | | Car Trailer |_______________| | CarAndTrailer So there is only one instance of "Vehicle" and its members. In my case I have class InsetBase { virtual BufferView * view() { return 0; } }; class DialogedBase { virtual BufferView * view() = 0; void showDialog() { if (!view()) return; ... } }; class InsetCitation { virtual BufferView * view() { return ...; } }; I'd like DialogBase::showDialog to have access to InsetBase::view(). The advantage: only classes that have a dialog need to bloat the interface with all those extra methods. But, as André points out, it might all be hot air. I should try it out first. Incidentally, I got all this from C++ Annotations (on our recommended reading list) which is downloadable off the web and is GOOD! -- Angus