title: Avoid code duplication by using inheritance
body: <p>I come from a C++ background where multiple inheritance is not a problem. Hoewever in Java I'm constrained to use either only class to inherit from or implement an interface.
  I have multiple classes that already extends another class. But all these classes should share the same debug interface/class.
  How do I implement such behaviour without duplicating my debug logic multiple times?</p>
  
  <p>Consider my current setup:</p>
  
  <pre><code>public interface Debug
  {
    public abstract void log();
  }
  
  public class ClassA extends AnotherBaseClass implements Debug
  {
    public boolean doDebug = false;
  
    public void log()
    {
      if( doDebug )
        System.out.println( "LOG" );
    }
  }
  
  public class ClassB implements Debug
  {
    public boolean doDebug = false;
  
    public void log()
    {
      if( doDebug )
        System.out.println( "LOG" );
    }
  }
  </code></pre>