I have a C++ question. I wrote the following class:
class c
{
int f(int x, int y){ return x; }
};
the sizeof() of class c returns \"1\"
Q: Do virtual functions take space on a per-object basis and therefore increase the sizeof an object?
A: No. The more virtual functions, the larger the vtable. The the more subclasses, the more vtables. If a class has no virtual functions, then there's no need for either a vtable or a (per-object) vtable pointer.
But none of this affects "sizeof". The functions themselves take a fixed amount of space, regardless.