Use virtual functions if overrides are possible

Member functions can't be changed between virtual and nonvirtual without breaking callers (except for private functions under some conditions). If you think you might ever want to override a function, make it virtual (unless it's private, in which case you can safely change it to virtual later if it's not called from an inline). It is possible to add a second function that is virtual and have the original one call it, but that's less efficient (you always pay for two function calls).


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker