โ 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: 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.