Whats the overhead using virtual methods? How much memory and performance do i loose?
Printable View
Whats the overhead using virtual methods? How much memory and performance do i loose?
From what I've seen it doesn't make a huge difference. But then again I may be wrong :)
:confused: eeeh, well i need to know a bit more than that :)
I'm pretty sure you don't loose anything, they're just for the compiler, when it's compiled it's like they weren't there.
So I was right? ;)
I'm reading a tutorial that refers to this overhead, i'm afraid it's important to me, since I really want to have virtual methods on some very extensively used classes.
from the Q&A section in http://www.itknowledge.com/reference...8/htm/ch13.htmQuote:
Q. Why not make all functions virtual?
A. Virtual functions are supported by a virtual function table, which incurs runtime overhead, both in the size of the program and in the performance of the program. If you have very small classes that you don't expect to subclass, you may not want to make any of the functions virtual.
Also another quote about multiple inheritance:
Is there something i should be aware of with reference to overheads, since i'm planning to use multiple inheritance?Quote:
New Term: An interface is much like an Abstract Data Type in that it defines a set of functions that can only be implemented in a derived class. However, with interfaces, you don't directly derive from the interface, you derive from another class and implement the interface, much like multiple inheritance. Thus, this marriage of an abstract data type and multiple inheritance gives you something akin to a capability class without the complexity or overhead of multiple inheritance. In addition, because interfaces cannot have implementations nor data members, the need for virtual inheritance is eliminated.
Well I guess I would also like to know, I'm an inheiritance newbie :rolleyes: