Tagged Questions
4
votes
6answers
1k 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 ...
8
votes
3answers
237 views
Should I implement an interface directly or have the superclass do it?
Is there a difference between
public class A extends AbstractB implements C
{...}
versus...
public class A extends AbstractB
{...}
AbstractB implements C
{...}
I understand that in both cases, ...
6
votes
6answers
2k views
What are the differences between abstract classes, interfaces, and when to use them
Recently I have started to wrap my head around OOP, and I am now to the point where the more I read about the differences between Abstract classes and Interfaces the more confused I become. So far, ...
1
vote
3answers
2k views
Abstract class + Inheritance vs Interface
Hello fellow programmers,
I am reading a book on C# and the author is comparing Abstract classes and Interfaces. He claims that if you have the following "abstract class:"
abstract class ...
12
votes
4answers
567 views
Is there a different usage rationale for abstract classes/interfaces in C++ and Java
According to Herb Sutter one should prefer abstract interfaces (all pure virtual functions) to abstract classes in C++ to decouple the implementation as far as possible. While I personally find this ...
4
votes
3answers
407 views
Switching from abstract class to interface
I have an abstract class which has all abstract methods except one which constructs objects of the subclasses. Now my mentor asked me to move this abstract class to an interface.
Having an interface ...
1
vote
2answers
824 views
What other reasons are there to write interfaces rather than abstract classes? [duplicate]
Possible Duplicate:
When to use abstract classes instead of interfaces and extension methods in C#?
When I read and looked at codes using Abstract classes, I was able to justify it because ...
6
votes
4answers
1k views
Can I consider interface methods as abstract methods?
I was thinking about that, and I had some doubts.
When I declare an interface, for example:
public interface MyInterface
{
public void method1();
public void method2();
}
Could these ...
31
votes
7answers
16k views
When to use abstract classes instead of interfaces with extension methods in C#?
"Abstract class" and "interface" are similar concepts, with interface being the more abstract of the two. One differentiating factor is that abstract classes provide method implementations for derived ...