News for hackers. Stuff that matters.
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.
Re:If Inheritance is so bad, why does everyone use it? by touisteur on Thursday April 11, 2024 @02:51PM (#40005503)
Interface inheritance could do the trick then? Maybe function pointers even.