https://kotlinlang.org logo
Title
n

noncom

02/08/2018, 9:17 AM
@karelpeeters yes, I know about how static denies inheritance in Java and such.. but what about such a situation? https://gist.github.com/noncom/921a4e322e89424c961eae54bcac41e4
c

Czar

02/08/2018, 9:23 AM
companion object is an object, objects can implement interfaces. This for example totally works:
class SomeClass {
	companion object : Decoder {
		override fun decode(encodedObject: Encoded): String {
			TODO("not implemented")
		}
	}
}

interface Encoded
interface Decoder {
	fun decode(encodedObject: Encoded): String
}