Design Pattern for deriving multiple classes of com object

Jul 9 2015 6:35 AM
 

Hi Guys,

I am developing an application which uses a com dll.

The com dll provides 2 classes, which inherit from another class.

Class B inherits from A
Class C inherits from A

I'm looking for a design pattern and an example how to implement my problem.
The 2 derives classes are very similar and have the same properties and methods for 95%.

So I would like to create ONE new derived class "E" (for both B and C) in my project which also have the same methods and properties for 95%. I do not want to write all functions twice for each class I inherit.
So I want class E to figure out if its derived from B or C.

What would be the best way to solve this, using maybe a design pattern, and can you please provide a short example.

Thanks, William


Answers (6)