You can declare a custom constructor on your class, replacing the default zero-parameter constructor.
The simple way to customize the constructor is to add parentheses after your class name and list constructor parameters there.
Unlike function parameters, though, constructor parameters can optionally
be marked with var
or val
, indicating that they are exposed as properties
to the rest of your class.
You can learn more about this in:
Tags: