scala - Specify attribute value on constructor -
i´ve been looking this, not find anything.
if have class
class a(a1:int, b1:int,c1:int){}
i can not create instance specifying 1 of values of constructor in groovy right?.
new a(b1:1)
you can provide default values class parameters:
// add default values class parameters class a(a1: int = 0, b1: int = 0, c1: int = 0) // call constructor passing parameters of choice val = new a(b1 = 1)
Comments
Post a Comment