I was asked in an interview "when would you not use inheritance." And I paused because the only thing I could articulate was "when it doesn't make sense?"
This was for a .NET position, by the way.
The thing that puzzled me about this question was that I didn't really know how to say it. You don't use inheritance when it doesn't apply to the software architecture. And that's more or less what I said, but I was wholly unsatisfied with my answer.
After the interview was done as I was doing my after-action report, I had this sneaking suspicion that he wanted me to mention composition. And as I write this post, I also feel like I should have added immutability, you don't want inheritance on objects that are meant to be immutable (like Java's
But now it bothers me. What would be a good answer to that question?