Want to extend and implement at the same time in Kotlin? There’s no syntactic difference between interface implementation and class inheritance. Simply list all types comma-separated after a colon : as shown here:
1 2 3 4 | abstract class MySuperClass interface MyInterface class MyClass : MySuperClass(), MyInterface, Serializable |
Multiple class inheritance is prohibited while multiple interfaces may be implemented by a single class.
Reference:
https://stackoverflow.com/questions/48391217/extend-and-implement-at-the-same-time-in-kotlin
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.