whats the difference between abstract and interface?
June 19, 2010 at 12:16 PM
Difference between Abstract class and Interface:
1)An interface represents only the boundaries of a class/classes that implement the interface, and contains no functionality while An abstract class represents a base class, from which other classes can inherit functions.
2)All methods are abstract in Interface while in Abstract class, at least one method is abstract.
3)In an interface, members are public by default while abstract class may contain non-public members.
4)Interface can be used to achieve multiple inheritance while abstract class can be used as a single inheritance.
5) Interface is more flexible than abstract class because one class can only "extends" one super class, but "implements" multiple interfaces.