Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyList[T](elems: T*){
- .....
- def *(x: double){
- val xs = elems.map((p: T) => p * x) // Arbitrary type T has no method * defined
- new MyList[Double](xs)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement