Created
October 19, 2016 17:01
-
-
Save sandeepkota/adcbea9ce3fdac6ac33cd78351fe4424 to your computer and use it in GitHub Desktop.
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 Zoo(str: String) | |
trait FZ | |
case class Foo(z: Zoo) extends FZ | |
case class Bar(z: Zoo) extends FZ | |
def some(f: FZ) = { | |
f match { | |
case Foo(z) | Bar(z) => | |
println(z.str) | |
// Since 'z' is of Same type, can I get it here? | |
} | |
} | |
Foo(Zoo("Some")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment