All Questions

650
votes
30answers
127195 views

What does it mean to "program to an interface"?

I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this? I know what interfaces do, but the fact I am not clear on this makes me think I am missing...
1111
votes
32answers
546851 views

Interface vs Abstract Class (general OO)

I have had recently two telephone interviews where I've been asked about the differences between an Interface and an Abstract class. I have explained every aspect of them I could think of, but it seem...
676
votes
39answers
121639 views

Interface vs Base class

When should I use an interface and when should I use a base class? Should it always be an interface if I don't want to actually define a base implementation of the methods? If I have a Dog and Cat ...
539
votes
11answers
127370 views

C# Interfaces. Implicit implementation versus Explicit implementation

What are the differences in implementing interfaces implicitly and explicitly in C#? When should you use implicit and when should you use explicit? Are there any pros and/or cons to one or the other...
1326
votes
34answers
888136 views

What is the difference between an interface and abstract class?

What exactly is the difference between an interface and abstract class?
411
votes
14answers
293937 views

Type List vs type ArrayList in Java

(1) List<?> myList = new ArrayList<?>(); (2) ArrayList<?> myList = new ArrayList<?>(); I understand that with (1), implementations of the List interface can be swapped. It ...
698
votes
15answers
403493 views

How do you declare an interface in C++?

How do I setup a class that represents an interface? Is this just an abstract base class?
158
votes
14answers
94015 views

How do you find all subclasses of a given class in Java?

How does one go about and try to find all subclasses of a given class (or all implementors of a given interface) in Java? As of now, I have a method to do this, but I find it quite inefficient (to say...
322
votes
21answers
243755 views

When to use an interface instead of an abstract class and vice versa?

This may be a generic OOP question. I wanted to do a generic comparison between an interface and an abstract class on the basis of their usage. When would one want to use an interface and when would...
191
votes
12answers
194678 views

Java Pass Method as Parameter

I am looking for a way to pass a method by reference. I understand that Java does not pass methods as parameters, however, I would like to get an alternative. I've been told interfaces are the alter...

Previous Next