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
// 점과 면이 있다. | |
case class Point(x: Double, y: Double) | |
case class Dimension(width: Double, height: Double) { | |
override def toString: String = s"Dimension(width: $width, height: $height)" | |
} | |
// 요소와 경계가 있다. | |
case class Element(x: Double, y: Double, width: Double, height: Double) | |
case class Bound(x: Double, y: Double, width: Double, height: Double) { |
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
// 점과 면이 있다. | |
case class Point(x: Double, y: Double) | |
case class Dimension(width: Double, height: Double) { | |
override def toString: String = s"Dimension(width: $width, height: $height)" | |
} | |
// 요소와 경계가 있다. | |
case class Element(x: Double, y: Double, width: Double, height: Double) | |
case class Bounds(x: Double, y: Double, width: Double, height: Double) { |
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
object Daddy{ | |
val objName = "Singleton Object Instance!!" | |
def apply(name:String) = new Daddy(name) | |
def apply(name:String, name2: String) = new Mommy(name, name2) | |
def printName(person:Daddy) { println(person.name)} | |
def printName(person:Mommy) { println(person.name)} | |
} | |
trait Person{ |
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
// ----------------------------------------------- | |
// scalaJS 로 스칼라 오브젝트, 클래스, 메소드 등을 | |
// JS 로 내보내기 예제 | |
// ------------------------------------------------ | |
import js.annotation.JSExport | |
import js.annotation.JSExportNamed | |
import js.annotation.JSExportAll | |
import scala.annotation.meta.field | |
import js.annotation.JSExportDescendentObjects |
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
//----------------------------------------------- | |
// 스칼라 JS 객체와 스칼라 객체 간 변환 예제코드 | |
//----------------------------------------------- | |
import scala.scalajs.js | |
import js.JSConverters._ | |
object ScalaJSExample extends js.JSApp{ | |
def main() = { |