What are the advans/disadvans of using class member functions vs normal functions?
I think a lot of people worry about the ''hidden'' costs of inheritance, so instead they make a single class with a type variable saying which subtype it is, and use switch statements all over the place. I can understand why - it''s difficult to trust code you can''t see. However, apart from the extra time it takes to code all those switch statements, you also introduce more potential places for bugs. But the main thing is that almost no switch-based subtype implementation is gonna be significantly faster than vtable lookups anyway. So you don''t gain much Sensible use of objects cuts development time and source code size, leaving you more time to work on gameplay!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement