Answered step by step
Verified Expert Solution
Link Copied!

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:
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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

Students also viewed these Databases questions

Question

=+Create an open dialogue among users?

Answered: 1 week ago