Templates are useful when a specific bahaviour (or say a ds with some functionality) is independent of data type on which it operates.
Whereas inheritance is useful when a)code reuse b)more specifically (as in case of polymorphism) you want to have different specific behavior with a generic name for the behavior.
No comments:
Post a Comment