Join Slack
Communities
Powered by
Does kotlin have an equivalence of the C++ static ...
# announcements
v
v79
05/03/2018, 8:46 AM
Does kotlin have an equivalence of the C++ static member field? It can be done in Java, but I can't think how I'd do it in kotlin.
https://www.geeksforgeeks.org/static-keyword-in-java/
d
diesieben07
05/03/2018, 8:50 AM
Usually a companion object is used for static in Kotlin:
https://kotlinlang.org/docs/reference/object-declarations.html#companion-objects
Sometimes a top level property resp. function can also be appropriate though.
v
v79
05/03/2018, 11:51 AM
I just hadn't thought through how I'd make it work with a companion object. Sorted now, thanks.
2
Views
Open in Slack
Previous
Next