Inheritance from inner classes across path-dependent types

In Java, it is possible to inherit from the inner class according to each instance by calling super() via the reference of the enclosing class.


public class Outer {
    class Inner {}

public class Unrelated extends Outer.Inner {
    public Unrelated(Outer ref) {

Is it possible to do the same with Scala?

I think in Scala you would do

class Outer {
  class Inner

val ref = new Outer
class Unrelated extends ref.Outer

Or even

def Unrelated(ref: Outer) = new ref.Inner {}

Which is short for

def Unrelated(ref: Outer) = {
  class Unrelated extends ref.Inner
  new Unrelated

Thank you. I found out that there is a way to declare a variable of the enclosing class type or use it as a method argument.

It doesn’t seem to be possible to solve using constructor arguments like Java…
(But, Scala seems simpler than Java.)