Static inner classes in scala

前端 未结 5 1445
旧时难觅i
旧时难觅i 2020-12-28 14:03

What is the analog in Scala of doing this in Java:

public class Outer {
  private Inner inner;

  public static class Inner {
  }

  public Inner getInner()          


        
5条回答
  •  清酒与你
    2020-12-28 14:31

    From scala-lang:

    there is no notion of 'static' members in Scala. Instead, Scala treats static members of class Y as members of the singleton object Y

    So it seems you could have a class defined inside an Object, but not a static class defined inside a class.

提交回复
热议问题