Obtaining a KClass from an object

How can I obtain a KClass from an object? I'm looking for the equivalent of Java's Object.getClass(). I've looked in the docs but haven't found anything, am I missing something?

This works but I can’t believe it’s the best way to do it:


Yes, this is currently the preferred way to obtain a KClass instance from an object. This will improve at some point in the future and will be just "foo::class"