联合类型的新实现,利用 <:<

def f[A](a: A)(implicit ev: (Int with String) <:< A) = println("OK")
f(2)
f("hi")

从这里面可以看出来
trait A
trait B
trait C with A with B

C 是 A 的子类,也是 B 的,可以在声明的时候,用 <:< 判断

联合类型的新实现,利用 <:<》上有3条评论

    1. Lolly

      go away it alone just how it stands, it doesnt really have to operate. probably just a little &#a;202n8vel jelly” to stop the rust. do not restore it. on the identical stage in time I had a 59 dodge suburban wagon painted in the incredibly very similar color scheme. the PB trans chirped 2nd gear. heady days my friends.

      回复
  1. Suzy

    Hei pa deg,jeg har samme kamera, men har ingen andre linser enn den standard linsa. Er veldig glad i kameraet, men jeg synes det er litt tungt/stort a dra med in.lmeliomn.. Men jeg er alltid glad NAR jeg har gjort det. Bildene blir klart mye bedre!

    回复

发表评论

电子邮件地址不会被公开。