CJCoding With Joseph

Using the Override Keyword

Create a base class Bird with a virtual method string sound() const that returns "generic".

Create a derived class Sparrow that overrides sound() to return "chirp". Mark the override with the override keyword.

When called through a Bird* that points to a Sparrow, the program prints:
chirp

Do NOT write a main function.

Expected Output:

chirp
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.