Answered step by step
Verified Expert Solution
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.
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 RoarStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started