Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.47 KB | None | 0 0
  1.     class Thing
  2.     class Creature extends Thing
  3.     class Human extends Creature
  4.  
  5.     abstract class Two {
  6.       def bi[A, B <: A](a: A, b: B): String
  7.       def bis[A, B <: A](a: A, b: B): A
  8.     }
  9.  
  10.     class Twos extends Two {
  11.       // CORRECT
  12.       def bi[Creature, Human](a: Creature, b: Human): String = { "asd" }
  13.      
  14.       //ERROR: class type required but Creature found  
  15.       def bis[Creature, Human](a: Creature, b: Human): Creature = { new Creature }
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement