CJCoding With Joseph
15free / daySign inCreate account

Multiple Inheritance Basics

A class can inherit from more than one base class at the same time, gaining the members of all of them.

Flyer (already written) has string fly() const returning "flying".
Swimmer (already written) has string swim() const returning "swimming".

Create a class Duck that inherits publicly from BOTH Flyer and Swimmer.

The runner calls fly() and swim() on a Duck and prints the output shown in Expected Output.

Do NOT write a main function.

Expected Output:

flying swimming

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