How to access "instance" in a class method? #320
Answered
by
bioball
pauloborges
asked this question in
Q&A
-
Hello folks, I tried to find out if this has been asked before, but I couldn't find anything. How do I access the whole class instance using a method? For example: class Foo {
bar: String
function hello(): String = fooer(???)
}
function fooer(foo: Foo): String = throw("not implemented") |
Beta Was this translation helpful? Give feedback.
Answered by
bioball
Mar 14, 2024
Replies: 1 comment 1 reply
-
Also, in order for this to work, you'll need to make -function fooer(foo: Foo): String = throw("not implemented")
+const function fooer(foo: Foo): String = throw("not implemented") |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
pauloborges
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fooer(this)
would pass in this instance ofFoo
.Also, in order for this to work, you'll need to make
fooer
const
: