← Back to Inheritance
Question 445
Multiple Inheritance Basics
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) hasstring fly() constreturning "flying".Swimmer(already written) hasstring swim() constreturning "swimming". Create a classDuckthat inherits publicly from BOTHFlyerandSwimmer. The runner callsfly()andswim()on aDuckand 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
Sign in to use hintsTopics:
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.