|
Scala example source code file (t0528neg.scala)
The Scala t0528neg.scala source code
trait Sequ[+A] {
def toArray: Array[T forSome {type T <: A}]
}
class RichStr extends Sequ[Char] {
// override to a primitive array
def toArray: Array[Char] = new Array[Char](10)
}
object Foo extends App {
val x: RichStr = new RichStr
println(x.toArray) // call directly
println((x: Sequ[Char]).toArray) // calling through the bridge misses unboxing
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala t0528neg.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.