Created
October 26, 2020 01:36
-
-
Save rupeshtr78/2b871ab39caf1a40a8b90fdf0fd56c8f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Type classes (implicit objects) | |
def foo2[B, A<:B] (a:A,b:B) = print("OK") | |
class A; | |
class B; | |
implicit def a2b(a:A) = new B | |
foo2(new A, new B) // implicit conversion! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment