Inheritance C++ (Diamond dread) -


i have following problem inheritance (i love google it, don't know correct keywords seems).

i have module class implements imodule interface function a(). have clientmodule class inherits module class , implements iclientmodule interface function b() inherits imodule interface. starting ambiguity , double inheritance problems.

here class diagram should tell bit more problem:

enter image description here

i need have separated access module class imodule interface , clientmodule iclientmodule interface offers access imodule interface well.

make iclientmodule not inherit imodule (and rename iclient). in clientmodule, inherit module , implement iclient.

or, alternative solution written after reading comments:

make clientmodule class inherit iclientmodule in example. however, instead of inheriting module, give clientmodule member variable module, , forward calls member needed. this:

class imodule { virtual void a() {} }; class module : public imodule { ... }; class iclientmodule : public imodule { virtual void b() {} };  class clientmodule : public iclientmodule  {     // ...     virtual void a() { _module.a(); }  private:     module _module; }; 

however, still better avoid mashing these , use original solution.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -