November 1999
Intermediate to advanced
336 pages
6h 29m
English
We previously noted that some compilers will refuse to inline virtual methods. This may have seemed like it should be obvious. After all, a virtual method is one for which the binding is delayed until run-time. Virtual methods are generally considered to be always called indirectly via a function pointer table. Although this view of virtual methods is in general accurate, it is not totally so. Take, for example, the following code fragment:
inline
virtual
int x::y (char* a)
{
...
}
void z (char* b)
{
x_base* x_pointer = new x(some_arguments_maybe);
x x_instance(maybe_some_more_arguments);
x_pointer->y(b);
x_instance.y(b);
}
y() is a virtual method, but its binding doesn't always need to be delayed until runtime. In ...
Read now
Unlock full access