Original Post
Greetings, I hope what I describe next makes sense. I have been given two interface classes (pure virtual/abstract classes). One interface says I must implement functions F(x) and G(x). The other interface says I must implement functions F(x) and H(x). The functionality of F(x) is identical to both classes. My initial thought was to make a base class, Bclass, that implements F(x). I'd then make two derived classes, Dclass1 and Dclass2. Dclass1 would inherit from Bclass, inherit the F(x) function, and implement G(x). Dclass2 would inherit from Bclass, inherit the F(x) function, and implement H(x). Pretty striaght forward and simple. Now, how do I make Dclass1 a derived class of the interface that says I must implement F(x) and G(x)? How do I do the same for Dclass2? Is it possible somehow for Dclass1 to inherit both Bclass and the abstract interface, implement G(x), and have the Bclass implementation of F(x) satisfy the requirement (from the abstract interface class) that Dclass1 implement F(x)? I could make them completely seperate entities, and duplicate the functionality of F(x). However, this code duplication seems undesirable, and I'm thinking there must be a way to avoid it. (Some notes: F(x) represents a lot of funcionality, say, 90% of what Dclass1 and Dclass2 will do, so it would be a lot of code duplication. G(x) and H(x) functionality are completely seperate/independant from each other. In other words, I wouldn't want a single class that implemented everything. They have to be two seperate classes. I have been given the interfaces as abstract classes and do not have the power to change them.)