Reading Time: < 1 minute

Classes can have properties. Similarly to regular variables, properties declared using the var keyword are mutable, i.e. they can be reassigned.

Syntax of a property

To declare a read-only property, we should use the val keyword.


Each object has it’s own unique values for it’s clas properties. In order to use properties, simply refer to it by name on the object using a dot.

Usage of properties

One more example


We have here a User class, what has a Primary Constructor whit 3 arguments. In this case we can assign value to the unmutable (var) variable.

We can get or set the properties of an object using the dot (user.age) notation.


I hope the description was understandable and clear. But if you have still questions, then leave me comments below! 😉

Have a nice a day! 🙂  



Follow and like us:
Click to rate this post!
[Total: 0 Average: 0]

2 thoughts on “Properties”

Leave a comment

stay informed!

Subscribe to receive exclusive content and notifications