When to use delegation instead of inheritance? [closed]
When you want to “copy”/Expose the base class’ API, you use inheritance. When you only want to “copy” functionality, use delegation. One example of this: You want to create a Stack out of a List. Stack only has pop, push and peek. You shouldn’t use inheritance given that you don’t want push_back, push_front, removeAt, et … Read more