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.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment