If the override specifier is added to the end of a member function declaration, what happens if the function is not specified as virtual in the parent class?

a. The function is overridden in the derived class.
b. There is a compiler error.
c. The function in the parent class will always be invoked.


b
Explanation: The override specifier is optional. It tells the programmer which functions are being overridden. However, even without the override specifier, a function in the derived class will override the corresponding function in the parent class as long as the function in the parent class is marked virtual. However, if the virtual keyword is missing from the function in the parent class, then we cannot override it. Adding the override specifier in this case results in a compile time error. override is available in C++11 and later versions of C++.

Computer Science & Information Technology

You might also like to view...

If tree and oak are in a hierarchy of classes, tree would be the _______________.

What will be an ideal response?

Computer Science & Information Technology

The user account type that lets you make changes that will affect other users of the computer and permits the most control over the computer is the:

a. administrator account b. guest account c. standard user account

Computer Science & Information Technology

After clicking File, Open, and then the All PowerPoint Presentations arrow, which files will be listed?

A) All files in a format PowerPoint recognizes B) Only PowerPoint files C) All files on whichever drive you specify D) All files on your hard drive

Computer Science & Information Technology

Match the definition with the correct term.

_____ 1. average of the values in a data set _____2. the study of methods for approximating solutions to mathematical problems _____3. analysis of the relationship between dependent and independent variables _____ 4. root-finding method that approximates f (the function whose root is sought) by a line joining two points known to be on the curve of f. _____5. a statistic indicating how well a line models the relationship between a dependent variable and an independent variable _____6. a statistic that measures the spread of the values in a data set _____7. a variable that influences or explains the outcome of a certain event _____8. success of a numerical method using a sequence of approximations to find an acceptable solution to a problem _____9. analysis that models as a straight line the relationship between a single dependent variable and a single independent variable _____10. root-finding method that approximates f (the function whose root is sought) by a tangent to the curve of f in a region close to a root _____11. outcome of a certain event that one tries to predict using regression analysis _____12. failure of a numerical method to find an acceptable solution to a problem by means of a sequence of approximations A. correlation coefficient B. linear regression C. regression analysis D. independent variable E. dependent variable F. standard deviation G. arithmetic mean H. secant method I. Newton's method J. divergence K. convergence L. numerical analysis

Computer Science & Information Technology