Skip to content

Instantly share code, notes, and snippets.

@jamesmcm
Created November 15, 2019 21:31
Show Gist options
  • Select an option

  • Save jamesmcm/2636b62715606b07ad2cf5cf85074020 to your computer and use it in GitHub Desktop.

Select an option

Save jamesmcm/2636b62715606b07ad2cf5cf85074020 to your computer and use it in GitHub Desktop.
abstract_type.scala
abstract class SpaceObject() {
type T <: SpaceObject
def ===(that: T): Boolean
}
class Sphere(val transform: Matrix, val material: Material) extends SpaceObject {
type T = Sphere
final def ===(that: Sphere): Boolean = {
transform === that.transform && material === that.material
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment