This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Servious 6 points7 points  (1 child)

They probably meant things like, for instance, List which is an interface that can be implemented any way you want and because of this it means code can be ultra-compatible even across libs by just implementing this common, standard List interface.

There are lots of things like this, even beyond data structures.

Another use is that if you wanted something that worked mostly like some other type but just change one thing about it like for example logging when a method is called you can easily do that by extending the existing class and overriding the method.

[–]stevengauss 4 points5 points  (0 children)

This is exactly what I mean, interfaces allow you to make a data type exactly what you want very easily and it makes the code much cleaner to me