Question: 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 Roar
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
