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 {}

4 comments
Comment actions Permalink

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.

0
Comment actions Permalink

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.

0
Comment actions Permalink

I see.  You could follow it with a "Use base type wherever possible" applied to what is now the intermediate class.  

0
Comment actions Permalink

That sounds a bit less than automatic then

0

Please sign in to leave a comment.