Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Groups Form a group of up to 3 students for this workshop. All students in the group will receive the same marks for this
C++
Groups Form a group of up to 3 students for this workshop. All students in the group will receive the same marks for this workshop. Part 1- Abstract Classes 1-1 Defhne and implement a class named animal that has the following constructor and attributes: aninal(string n, int v) creates an aninal with nase n and body volune v. // aninals are allocated a unique ID on creation the aninal's nane // the aninal's unique 1o // the volune of the aninal's body string nane int aninallo j int volune Following the principles of encapsulation and information hiding, set the proper access modihers 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, animaliD and volume. There must not be set function for animalD. The get and set function names should be the attribute name prefxed 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 solecting between the three types of access modifers 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 nome and animaliD. Part 2 - Inheritance
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