title: Make a class extends another class at runtime
body: <p>There is a library have a base class (let's call it CBase) that performs some tasks and one can create classes that extends this CBase class.</p>
  
  <p>The behavior of the CBase is not enough for me, so I would like to create my own CBase class (let's call it MyCBase) that have the same methods and members but these methods don't do the same thing.</p>
  
  <p>Until now everything is ok. But what blocks me is that I would like to replace CBase by MyCBase. However, I have a lot of classes that extend CBase and I don't want to change them all.</p>
  
  <p>Is it possible to replace CBase by MyCBase at runtime ?
  So that</p>
  
  <pre><code>public class A extends CBase {}
  </code></pre>
  
  <p>becomes</p>
  
  <pre><code>public class A extends MyCBase {}
  </code></pre>
  
  <p>Can I perform this using code enhancement ? (like we do to add methods to a class at runtime. Is it also possible to change inheritance this way ?)</p>
  
  <p>Thank you for your help !</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I would like to write a plugin for a framework, this is why I would like to change inheritance at runtime. This way users of the framework can use my plugin without changing their source code (changing the inheritance of their classes from CBase to MyCBase)</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>Is it possible to do like this: ?</p>
  
  <pre><code>CtClass cc = CtClass.forName("pkg.AClass");
  cc.setSuperclass(CtClass.forName("mylib.MyCBase"));
  cc.compile();
  </code></pre>