Created
November 23, 2013 16:48
-
-
Save paulspencerwilliams/7616944 to your computer and use it in GitHub Desktop.
Why do I get a "error: not found: type LineElement" when trying to load this scala file?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Element { | |
def contents: Array[String] | |
def height: Int = contents.length | |
def width: Int = if (height == 0) 0 else contents(0).length | |
def beside(that: Element): Element = { | |
new LineElement("hello") | |
} | |
} | |
class ArrayElement(conts: Array[String]) extends Element { | |
def contents: Array[String] = conts | |
} | |
class LineElement(s:String) extends Element() { | |
val contents = Array(s) | |
override def width = s.length | |
override def height = 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment