Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Interface inheritance could do the trick then? Maybe function pointers even.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: