Create two classes named Mammals and SeaAnimal. Create another class named Whale which inherits both the above classes. Now, create a function in each of these classes which prints "I am mammal" in class Mammals, "I am a marine animal” in class Marine and "I belong to both the categories: Mammals as well as Marine Animals" in class Whale. Now, create an object for each of the above class in main function and try calling. 1 - function of Mammals by the object of Mammal 2 - function of SeaAnimal by the object of SeaAnimal 3 - function of Whale by the object of Whale

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter13: Overloading And Templates
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Q1: Create two classes named Mammals and SeaAnimal. Create another class named Whale which
inherits both the above classes. Now, create a function in each of these classes which prints "I am
mammal" in class Mammals, "I am a marine animal” in class Marine and "I belong to both the
categories: Mammals as well as Marine Animals" in class Whale. Now, create an object for each of the
above class in main function and try calling.
1 - function of Mammals by the object of Mammal
2 - function of SeaAnimal by the object of SeaAnimal
3 - function of Whale by the object of Whale
4 - function of each of its parent by the object of Whale

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning