Java combine parents of two large inheritance chains

Posted by Soylent Green on Stack Overflow See other posts from Stack Overflow or by Soylent Green
Published on 2013-11-08T21:42:20Z Indexed on 2013/11/08 21:53 UTC
Read the original article Hit count: 154

Filed under:
|

I have two parent classes in a huge project, let's say ClassA and ClassB. Each class has many subclasses, which in turn have many subclasses, which in turn have many subclasses, etc.

My task is to "marry" these two "families" so that both inherit from a SINGLE parent. I need to essentially make ClassA and ClassB one class (parent) to both of their combined subclasses (children).

ClassA and ClassB both currently implement Serializable.

I am currently trying to make both inheritance chains inherit from ClassA, and then copy all functions and data members from ClassB into ClassA. This is tedious, and I think a terrible solution.

What would be the CORRECT way to solve this problem?

© Stack Overflow or respective owner

Related posts about java

Related posts about inheritance