I am building a relatively simple app and a little bit confused on a better practice of design.
I have a main class MClass. Classes Child1 and Chil2 both inherit from MClass. Now, there is another class AClass, which can inherit from either Child1 or Child2, but not both at the same time (which is only possible through, I believe, interface).
How do I go about having this optional inheritance from one or the other class?
There are also classes AChild1 and AChild2, which both inherit from AClass. The end result would be as follows:
MClass:Child1:AClass:AChild1
MClass:Child2:AClass:AChild2
These are the only two options possible. Is it better to simply combine AClass with its children having
MClass:Child1:AClass1
MClass:Child2:AClass2
I could do this but AClass1 and AClass2 would have a lot of redundant fields... Any reccomendations?
Thank you!
EDIT:
Here is a specific situation:
I have a piece of Equipment that can be either Type1 or Type2. Class Equipment has a bunch of properties. Type1 and Type2 have their own properties and they inherit from Equipment. Both Type1 and Type2 have cables. There is a class Cable with specific properties. In addition, Type1 and Type2 have different types of cables, CableType1 CableType2, which have their own specific properties and inherit fields from either Type1 or Type2.