Kotlin: Iterate over components of object
<p>Each data class object has a component for each property like component1, component2, etc..
I was wondering if there is any way in Kotlin to iterate over each component of a class.
Say I have class:</p>
<pre><code>data class User(age:Int, name:String)
</code></pre>
<p>Could I do something like:</p>
<pre><code>for(component in aUserObject){
    //do some stuff with age or name
}
</code></pre>
<p>?</p>