coder82
11/15/2018, 5:34 PMBurkhard
11/15/2018, 5:36 PMclass Foo(a: String, b: String)
you say that you want the primary constructor to take 2 arguments (a and b). If you add val
or var
you also create 2 properties in the class which will automatically get assigned the arguments passed to the constructor.class Foo(val a: String)
is a short for
class Foo (a: String) {
val a: String = a
}
coder82
11/15/2018, 5:40 PMphldavies
11/15/2018, 5:50 PMvar
but they should all be properties certainlyShawn
11/15/2018, 5:50 PM