0

Possible Duplicate:
Interface vs Abstract Class (general OO)

I am little bit familiar with the terms Abstract class and the interface. But i want to know in which situation i have to use the interface and in which condition the abstract class.

Thanks

Community
  • 1
  • 1
Anshul
  • 635
  • 2
  • 11
  • 27
  • also possible duplicate of [Whent ouse an interface instead of an abstract class and vice versa](http://stackoverflow.com/questions/479142/when-to-use-an-interface-instead-of-an-abstract-class-and-vice-versa) – Jeff Apr 01 '11 at 07:37

2 Answers2

1

Interface vs Abstract Class should be a useful read.

In short, Abstract Classes are meant to be extended, as in you're giving someone a base to work off of. Interfaces ensure that things have a common way of interacting with one another without having to worry about the inside details.

Jeff
  • 1,807
  • 1
  • 15
  • 17
0

Simple answer: you can implements many interfaces, but can only inherit from one class, so if you want to inherit some logic, you should use Abstract Class, otherwise Interface is more extensible.

James.Xu
  • 8,249
  • 5
  • 25
  • 36