Tagged Questions
7
votes
11answers
729 views
Why do interfaces require methods over members?
...As this forces us to create getters and setters, which in practice are often totally extraneous? Is there any good language-design reason why interfaces in most (all?) languages do not allow member ...
6
votes
3answers
334 views
Use cases for “private” interfaces?
I was wondering if there was a valid use case for being able to properly define the specific internal properties and functions of a class in a way similar to how an interface defines the public ...
5
votes
6answers
3k views
Is there any difference between interfaces and abstract classes that have abstract methods only?
Let's say we have an abstract class and let this class has only abstract methods. Is this abstract class different from an interface that has same methods only?
What I am looking to know is if there ...
4
votes
3answers
2k views
Why were default and static methods added to interfaces in Java 8 when we already had abstract classes?
In Java 8, interfaces can contain implemented methods, static methods, and the so-called "default" methods (which the implementing classes do not need to override).
In my (probably naive) view, there ...
3
votes
4answers
1k views
How can I explain C# interfaces, and constructors to a 8 years old kid?
How can I explain C# interfaces and constructors to a 8 years old genius kid?