Monday, June 28, 2010

Need of abstract class and Interface.

Abstract class and Interface are used when there is a difference in behavior among the sub-types extending the abstract class or implementing the interface.

Need of abstract class :
when the sub-types behavior is partially common and different with respect to the super-type then use an abstract class .
Need of Interface :
When the sub-types behavior is totally different then you use an interface.

More clarification let me know :