How to change class variable on runtime with function

class MyClass{
    var tochange:String="Hello"
}
fun changeMyClass(fun:(c:MyClass) ->(Unit)){
      fun(c)
printnl(c.tochange) //World
}
changeMyClass((c){
    c.tochange="World"
})

Is there a way?

SOLVED:

class ACT{
    var p="Test"
}
fun prep(function:(ob:ACT)->(Unit)){
    var ob:ACT=ACT()
    ob.p="Hello"
    function(ob)
    println("P is now "+ ob.p)
}
prep(
            {
                var ob=it
                   ob.p="World"
             }
        )

Why not:

class ACT(var p: String)

fun main() {
  val a = ACT("hellow")
  println("p is ${a.p}")
  a.p = "test"
  println("p is now ${a.p}")
}

If you only do it at class instanciation, i would remove the var and make it val.