Challenge 2: Implement an Animal Class
In this challenge, we'll implement a base class Animal and two derived classes Sheep and Dog.
Problem Statement
The code below has:
-
A parent class named
Animal
.- Inside it define:
Name
Sound
void Animal_Details()
function:- It prints the name and sound of the
Animal
.
- It prints the name and sound of the
- Inside it define:
-
Then there are two derived classes
Dog
class- has a private member
family
- has a function named
Dog_detail()
which prints detail of the dog
- has a private member