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

Question: 1 / 565

What keyword in C++ enables polymorphism?

static

virtual

In C++, the virtual keyword enables polymorphism by allowing a class to provide different implementations of functions within derived classes. The other options do not directly enable polymorphism. Static is used to define static variables or functions, const is used to specify constant variables, and extern is used to declare global variables. Although const and extern can also be used in C++ polymorphism, they are not the enabling keyword. Therefore, option B is the correct answer.

Get further explanation with Examzify DeepDiveBeta

const

extern

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy