posted 19 years ago
Both abstract classes and Interfaces have one goal in common. They should be used when the implementation is not specific. To make things clear let us say you have a 'Shape' class. Shapes could be of different kinds for e.g. a circle, a rectangle, a square etc. If 'Shape' class had a method called 'draw()', during designing you class, you cannot specifically say how this method should be defined. That's because each shape is drawn differently. So you have a draw method for square, a rectangle etc.
Here both abstract classes and interfaces can be used. Now if you want to enforce super-class sub-class relationship between shape and square and other classes you use abstract classes. Whereas in interfaces such relationship is not enforced.
Hope it's clear now..
Thanx for your effort. Keep smiling and enjoy life.