Introduce intermediate super class
Hi, I was wondering if there's a way to accomplish the following:
class Derived1 : Base {}
...
class DerivedN: Base {}
I would like to create a derived class of Base and automatically have the DerivedX classes inherit from that:
class IntermediateBase : Base {}
class Derived1 : IntermediateBase {}
...
class DerivedN: IntermediateBase {}
Please sign in to leave a comment.
You ought to be able to do an "Extract Superclass" against Base, and then select all members to pull up into the new base class. Your existing Base class becomes the intermediate class.
Not exactly, because I want to keep Base's identity, that is, anyone referencing Base should keep referencing Base and Base should stay the root of the hierarchy.
I see. You could follow it with a "Use base type wherever possible" applied to what is now the intermediate class.
That sounds a bit less than automatic then