Practice mode C++

Which syntax declares a pure virtual function in a C++ class?

Correct answer B. virtual void draw() = 0;

Explanation

A pure virtual function is declared with the pure-specifier = 0 after the declarator. A class with at least one pure virtual function is abstract and cannot be instantiated; derived classes must override the function to become concrete. C++ has no abstract keyword, and = null or a pure keyword are not valid syntax.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.