title: Inheritance with Scala 'object'
body: <p>I have this Java code:</p>
  
  <pre><code>class Super {
      public static void foo() { bar(); }
      public static void bar() { out.println("BAR");}
  
      public static void main(String[] args) {
          foo();
      }
  }
  class Sub extends Super {
      public static void bar() { out.println("bar"); }
  }
  </code></pre>
  
  <p>And I would like to see what it does in Scala, but can't seem to find how to write the equivalent. This is what I have:</p>
  
  <pre><code>object Super  {
    def foo() { bar() }
    def bar() { println("BAR")}
    def main( args : Array[String]) {
      foo()
    }
  }
  object Sub extends Super {
    override def bar() { println("bar")}
  }
  </code></pre>
  
  <p>But doesn't compile. It is because object can't inherit ?</p>