I'm learning Scala
using IntelliJ
IDE.
When I subs class Element
and override contents
method, IDE provided default implementation for contents
method with definition ???
Below 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 don't see any issues in running the program but when I access the method I get below 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 of it?
???
or::
that looks like an operator (i.e., part of the language), when it's actually just a method. Just like with any method, can just use your IDE to look up the definition of such "pseudo-operators" (e.g., CTRL + b in IntelliJ). – helios35 Dec 8 '17 at 16:22