CJCoding With Joseph

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:
flying swimming

Do NOT write a main function.

Expected Output:

flying swimming
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.