Can anyone point me to good articles regarding int...
# announcements
a
Can anyone point me to good articles regarding interfaces? I’m finding it pretty difficult to grasp the concept !! 😫
l
Do you want to use `interface`s for a specific use case? Also, did you check the `interface`s provided in the stdlib like
List
,
Comparator
and more? There are use cases for interfaces beyond that, but it might help you.
j
I assume the question is about the concept of interface in a class based language. Unforntunately, kotlin documentation for interfaces (https://kotlinlang.org/docs/reference/interfaces.html) assumes you already know what an interface is. As to grasping this context I would start by learning what a Java interface is (e.g. https://docs.oracle.com/javase/tutorial/java/concepts/interface.html, https://www.tutorialspoint.com/java/java_interfaces.htm or corresponding chapter in http://www.dblab.ntua.gr/~gtsat/collection/Java%20books/Bruce.Eckel.Thinking.In.Java.4th.Edition.Dec.2007.eBook-BBL.pdf ). And then, you can learn how kotlin interfaces are much more powerful. Note there may be better explanations (than those example links I provide) about what a Java interface is.
a
Thank you for your responses ! Yes I’m just starting out so I just wanted to know what makes interfaces special and use cases when an interface is more relevant rather than a class or an abstract class. I’ll go through the links that you have provided. Thanks for hearing me out !
l
abstract classes can hold a state (have fields), but you lose the ability to to inherit another class at implementation site.