Skip to content

Instantly share code, notes, and snippets.

@Shinpeim
Created December 6, 2016 08:56
Show Gist options
  • Save Shinpeim/922d0747a0655121d60cb6e2da2ebf64 to your computer and use it in GitHub Desktop.
Save Shinpeim/922d0747a0655121d60cb6e2da2ebf64 to your computer and use it in GitHub Desktop.

Revisions

  1. Shinpeim created this gist Dec 6, 2016.
    12 changes: 12 additions & 0 deletions nyan.scala
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    class ComponentBuilder[X](a: X, b:X) {
    class ClassA[X](val v: X)
    class ClassB[X](val v: X)

    def buildA = new ClassA(a)
    def buildB = new ClassB(b)
    }

    val b = new ComponentBuilder[Int](1, 2)
    println(b.buildA.v) // 1
    println(b.buildB.v) // 2