An abstract class, as in Java, cannot be instantiated and only inherited:
An abstract class, as in Java, cannot be instantiated and only inherited:
abstract class Soldier(val firstName: String, val lastName: String) {} // if you uncomment this line, it will fail compilation //val soldier = new Soldier
A class can be placed inside an abstract class just like in Java:
In contrast to Java, all values in Scala are objects (including numerical values and functions).
In contrast to Java, all values in Scala are objects (including numerical values and functions). Since Scala is class-based, all values are instances of a class.
Class hierarchy is linear, a class can only extend from one parent class:
A class that extends from another is polymorphic:
The parameterless execute method has been deprecated and will be removed in a future version of ScalaTest. Please invoke execute with empty parens instead: execute().
The trap method is no longer needed for demos in the REPL, which now abreviates stack traces, and will be removed in a future version of ScalaTest