Question: Answer in C + + Implement a class named Animal has two private member variables: name of type string and numLegs of type int, and

Answer in C++
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:
setName-Function to set the name
setNumLegs-Function to set the number of animal legs
getName-Value-returning function to return the name
getNumLegs-Value-returning function to return the number of animal legs
TEXAS A&M UNIVERSITY - CORPUS CHRISTI
School of Engineering & Computing Sciences
speak ()- Value-returning function to return the empty string
move ()- Value-returning function to return the empty string
print ()- Outputs the data stored in the instance variables with the appropriate titles
Constructor with parameter-Sets 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 0
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
 Answer in C++ Implement a class named Animal has two private

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!