When to use an abstract class?:
In case where you want to use implementation inheritance then it is usually
provided by an abstract base class. Abstract classes let you define some default behaviour and force subclasses to provide any specific behaviour.
When to use an interface?: For polymorphic interface inheritance, where the client wants to only deal with a type and does not care about the actual implementation use interfaces. If you need to change your design frequently,
you should prefer using interface to abstract. Justification for using interfaces
is that they solve the ‘diamond problem’ of traditional multiple inheritance.
No comments:
Post a Comment