CJCoding With Joseph
15free / daySign inCreate account

Preventing Override With Final

The final specifier stops a virtual method from being overridden by any further subclass.

Base class Engine has a virtual method string start() const returning "engine".

Create a derived class V8Engine that overrides start() to return "V8 started" and marks it so no subclass of V8Engine can override it further. Use override final.

Called through an Engine* pointing to a V8Engine, the program prints the output shown in Expected Output.

Do NOT write a main function.

Expected Output:

V8 started

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
Inheritance
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.