Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ pls, i will like the correct ans. Task 4: POLYMORPHISM You have to create three classes: Animal Class . Dog Class Lion Class Animal

c++ pls, i will like the correct ans.image text in transcribed

Task 4: POLYMORPHISM You have to create three classes: Animal Class . Dog Class Lion Class Animal will be a base class and other two should be derived from it. Animal class should contain a virtual makesound() function which will print "Dummy Sound". Dog and Lion class should inherit makes ungl) function and override it, But in Lion it should print "roar" and in Dog it should print "Bark" respectively. Now create a global function named as globalDisplay and it should recieve one parameter of Animal type and call the makesound!) inside it. { obimakeSoundo); } implement the above according to following: int main() { Animal animal Dog dog; Lion lion; global Display(animal); global Display (dog); globalDisplax(lion); } Output should be like: Dummy Sound Bark Roar

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

More Books

Students also viewed these Databases questions