Looking at this code from Scala in Depth...
scala> trait Foo {
| def someMethod(): Int = 5
| }
defined trait Foo
scala> class Main() extends Foo {
| }
defined class Main
Then, I created a new Main
(without the parentheses).
scala> class Main extends Foo {}
defined class Main
What is the meaning the parentheses in class Main()
? How about without parentheses?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…