Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1 - Abstract Classes 1-1 Define and implement a class named anlmal that has the following constructor and attributes: aninal(string n, int v) /

image text in transcribed

Part 1 - Abstract Classes 1-1 Define and implement a class named anlmal that has the following constructor and attributes: aninal(string n, int v) / creates an aninal with nane n and body volume v. string nane i int animalID int volune j // aninals are allocated a unique ID on creation // the aninal's nane // the aninal's unique ID // the volune of the aninal's body Following the principles of encapsulation and information hiding, set the proper access modifhers for the attributes and provide methods to access the object's data. You need to set the name and volume of an animal, as well as getthe animal's name, animallD and volume. There must not be a set function for animalD. The get and set function names should be the attribute name prefixed with "get, "or "set " respectively. For example, the get and setmethods for volume would be named get volume and set _volume respectively Declare the get name function as pure virtual. When selecting between the three types of access modifiers for each of the attributes, note that none of the attributes may be public but, in the further questions child classes of animal are to be implemented that will need to directly access the attributes name and animali. Part 2 - Inheritanrn

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 Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago