Tuesday, June 11, 2013

why we use abstract class?

Abstarct classes are meant for 'abstracting'.
means if some classes are having common behaviour, instead of writing evry time the same thing in each class, write that in one class and ask the other classes to use it[by making the classes as subclasses to the abstract class].
this is nothing but inheritance.
To summarise: 


Use abstract classes when you want default behaviour for some classes
Use interfaces when you want different behaviour different classes.

hope this helps you

No comments:

Post a Comment