RE: [GD-General] Multiple Inheritance and RTTI
Brought to you by:
vexxed72
From: Jay W. <woo...@Ro...> - 2003-02-06 01:00:37
|
With a single virtual call to a parameterless Render function, there's = not an advantage. But in other situations and/or for other reasons, a = QueryInterface style does have advantages: 1) When you want to call multiple functions offered by a single = interface, you can query once, test once, then call many times with = impugnity. That's quite possibly more efficient than calling a bunch of = potentially-empty virtual stubs. 2) Using a QueryInterface style allows you to avoid making the function = call entirely. If you use many virtual functions in place of an = interface, and if the functions take many parameters, you'll still have = to spend time pushing those parameters onto the stack, even if the = function turns out to be just an empty stub. (Compiler gurus please = correct or clarify, but I'm sure this is usually true.) 3) At development time, you won't have to alter the virtual base class = every time you want to add new functionality. > -----Original Message----- > From: Peter Dimov [mailto:pd...@mm...] > Sent: Wednesday, February 05, 2003 1:25 PM > To: gam...@li... > Subject: Re: [GD-General] Multiple Inheritance and RTTI > > What are the advantages of this approach over just providing=20 > a (possibly empty) render() in every node type? A virtual call can = never=20 > lose to a QI + test + potential call. |