2 ms·
Heavy template base code uses inheritance all the time. But here is no expectation of is-a relationship there, it is purely for code reuse. In template code, th
by gpderetta 6y ago
Heavy template base code uses inheritance all the time. But here is no expectation of is-a relationship there, it is purely for code reuse. In template code, the is-a is better expressed as modelling a concept (which is done mostly via structural typing, not nominal typing).
It is unfortunate that there is no explicit way to distinguish OOP is-a from code reuse, other than the presence of virtual functions in base classes, but in my 15 years of professional use of c++ I can't remember it ever being an issue.
- ncmncm 6y agoRight. Sometimes language features support an architectural pattern, sometimes they are just mechanism. And sometimes the same feature is one, sometimes the other. There is no shame in it. Language features are there to be used.