Answered step by step
Verified Expert Solution
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) /
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
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