CJCoding With Joseph

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:
V8 started

Do NOT write a main function.

Expected Output:

V8 started
Topics:
Inheritance
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.