Instantiating an object with many functions

Hopefully simple question: When an object is instantiated that inherits from a base class with virtual functions, does the existence of those functions make it more costly to instantiate, or does the cost only apply when that object calls the functions?

I guess this applies to more than just virtual function stuff.
Will a class with 1000 member functions take longer to instantiate than a class with 10 member functions (and the same amount of data members)?
Last edited on
It depends entirely on the compiler implementation. The most common/popular implementation is a pointer or two inside the object that points to some tables that house all the function pointers. Each class has its own table - not one table per instance, but one table per class. So, in this case, the number of virtual functions is irrelevant.
Last edited on
I see, thanks.
Topic archived. No new replies allowed.