Monday, January 16, 2012

What is the difference between abstract class and interface ?

  • Classes may inherit from only one base class, so if you want to use abstract classes to provide polymorphism to a group of classes, they must all inherit from that class.
  • Abstract classes may also provide members that have already been implemented. Therefore, you can ensure a certain amount of identical functionality with an abstract class, but cannot with an interface.
  • An abstract class can contain internal variables but interfaces cannot.

No comments:

Post a Comment