October 1997
Intermediate to advanced
800 pages
20h 48m
English
You have seen the impact that virtual functions have on application designs. With dynamic binding, methods resolve at run time, easing maintenance when you add new classes and behaviors to inheritance hierarchies. This late-binding mechanism (virtual) applies to any class member function and destructor.
Not all class member functions are dynamically bound, however. A constructor, for example, may not be virtual. Why not? Recall that a constructor's primary task is to convert raw memory into initialized objects. A constructor must also build tables of virtual function pointers for dynamic binding (see Figure 11.14 on page 557). Since a “virtual” table for an object cannot exist before the compiler calls a class constructor, ...