Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++

Question: 1 / 565

What happens to the VPTR if a class is derived from another class with virtual functions but does not override them?

It gets removed

It points to the base class's VTABLE

If a class is derived from another class with virtual functions but does not override them, the VPTR will still exist. It will point to the base class's VTABLE because the derived class inherits the virtual functions from the base class. Option A is incorrect because the VPTR is a crucial part of polymorphism and cannot be removed. Option C is incorrect because the VPTR stays the same at runtime. Option D is incorrect because the derived class does not have its own VTABLE, it shares it with the base class.

Get further explanation with Examzify DeepDiveBeta

It is reset at runtime

It points to its own VTABLE

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy