If I have a function that uses as first argument a...
# getting-started
v
If I have a function that uses as first argument an instance of a class, can I use the dot notation with it? I mean, can I have something like:
fun myFunction (foo :MyClass) { /.../ }
and call it like:
val foo = MyClass( /.../ )
foo.myFunction()
d
You can make an extension function instead.
fun MyClass.myFunction() { /.../ }
👍 1
Which will give you what you want.
v
Logical. Easiest solutions are the best, I was making some weird mental thinking, thanks!!