4 ms·
Yes, although (cache behavior notwithstanding) it's a single pointer indirection that can frequently be optimized away by the compiler.
by mcguire 9y ago
Yes, although (cache behavior notwithstanding) it's a single pointer indirection that can frequently be optimized away by the compiler.
- khitchdee 9y agoMy point is simply this -- adding protection mechanisms and inheritance to classes neccesitates adding more complexity to the structure used to represent them (such as a vtable) which does add performance overheads. If you dont need those features, you can go leaner and faster with a C structure that includes function pointers to give you the basic packaging of data and functions that an object has.