Yes, on a 32-bit pointer architecture, it will consume 4 bytes for the vtable.
Correct - however, if you really want to achieve this sort of thing, you will end up with some sort of indirection whatever solution you choose, so it's no worse than any other solution of the same problem. [Assuming of course that you NEED to use virtual functions].
The overhead is most noticeable on functions that do very little [e.g. getters & setters].
And it's worth noting that the overhead is most likely less than an if-statement, so if you end up with code that does:
Code:
if (isSometype)
// do something
else
// do else
in the non-virtual function, to avoid having a virtual function, then you are probably not gaining anything from the non-virtual solution.
not that I'm aware of - of course, the extra indirection causes a memory read which in turn touches the cache, so cache hit ratio will be marginally impacted.
if the compiler knows the full type of the object - e.g. it's not a pointer, then the function address can be found directly.