I am studying Scala
using the IntelliJ
IDE.
When I subs class Element
and overrides the method contents
, the IDE provided a default implementation for the method contents
with the definition???
Below is the code from the book Programming in Scala, 3rd edition
Element
abstract class Element {
def contents: Array[String]
def height = contents.length
def width = if (height == 0) 0 else contents(0).length
}
Arrayelement
class ArrayElement(cont: Array[String]) extends Element {
override def contents: Array[String] = ??? // impl provided by IDE
}
I do not see any problems when starting the program, but when I get access to the method I get below the exception
Exception in thread "main" scala.NotImplementedError: an implementation is missing
at scala.Predef$.$qmark$qmark$qmark(Predef.scala:284)
at org.saravana.scala.ArrayElement.contents(ScalaTest.scala:65)
Can someone explain what is ???
and use it?
source
share