what are the Differences between Abstract Class and Interface ?

SnoAbstract
Class
Interface
1 Can have implemented Methods Cant
2 A class can inherit only one abstract class A Class can implement any number of Interfaces.
3 We go for Abstract classes on such situations
where we need to give common functionality for group of related classes
We go for Interface on such situations where we
need to give common functionality for group of un-related classes
4 If you add a new method, then you can provide a
default implementation and so no need to make any change to existing work.
If you add a new method, then you need to change
all the existing work.
5
Static and Instance constants are possible.
Only
Static constants are possible.

0 comments:

Post a Comment