In Scala, how does one write a class with a constructor, not all of whose arguments are class member

Posted by user318816 on Stack Overflow See other posts from Stack Overflow or by user318816
Published on 2010-04-16T19:21:48Z Indexed on 2010/04/16 19:23 UTC
Read the original article Hit count: 241

Filed under:
|

I want to write class whose constructor takes two parameters, but the arguments are not actually members of the class. e.g.

class P(V1:Int, V2:Int) {
   val set = Set(V1, V2)
}

Having constructed the 'set', I don't actually care about V1 and V2. Is there a way of expressing this in Scala ?

© Stack Overflow or respective owner

Related posts about scala

Related posts about constructor