Re:If Inheritance is so bad, why does everyone use it?
by ano-ther on Thursday April 11, 2024 @04:47AM
(#39999899)
Yes. I have a framework for an embedded system that uses various types of sensors. When changing a sensor, instead of rewriting the polling loop for every new case, I can keep looping through ‘sensor[i]->sampleNow()’ and add the specifics in a class inheriting from SensorClass.
[ Parent
| on HN ]