Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implement a class named Animal has two private member variables: name of type string and numLegs of type int, and has the following member functions:
Implement a class named Animal has two private member variables: name of type string and numLegs of type int, and has the following member functions:
setNameFunction to set the name
setNumLegsFunction to set the number of animal legs
getNameValuereturning function to return the name
getNumLegsValuereturning function to return the number of animal legs
TEXAS A&M UNIVERSITY CORPUS CHRISTI
School of Engineering & Computing Sciences
speak Valuereturning function to return the empty string
move Valuereturning function to return the empty string
print Outputs the data stored in the instance variables with the appropriate titles
Constructor with parameterSets the values of the instance variables to the values specified by the user, in default: sets name to the empty string and number of legs to
Using an Animal class as a base class, implement two derived classes simulating a cat and Dog, each redefining three functions constructor, speak move to represent each animal the most suitable.
Then write the main class that creates instances of three above classes one for each
Step 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