parameter extends a class

Posted by coubeatczech on Stack Overflow See other posts from Stack Overflow or by coubeatczech
Published on 2010-03-19T14:29:52Z Indexed on 2010/03/19 14:41 UTC
Read the original article Hit count: 290

Filed under:
|

Hello, I want to do a class thats accepts anything ordered and prints greater. (I'm just learning so I know it's a bit useless)

class PrinterOfGreater[T extends Ordered](val a:T, val b:T){println(a > b)}

I know that it can't be written by this style in scala, but I don't know how to write it properly... Do anybody know?

© Stack Overflow or respective owner

Related posts about scala

Related posts about typeparameter