Question
C++ (1)Create three classes Human, Parent and Child with the following member variables and member function HUMAN Member Variables: Private: string name Private: int age
C++
(1)Create three classes Human, Parent and Child with the following member variables and member function
HUMAN
Member Variables:
Private: string name
Private: int age
Private: char sex
Member Functions:
Private: default constructor
Protected: constructor with three arguments
Public: All setters and getters
Public: virtual work()
Parent
inherit class Human
Additional Member Variables:
Private vector children Should be able to assign children as they are created
Additional Member Function:
Setter/Getter for children
Child
inherit class Human
Additional Member Variables:
Private: Parent Mom
Private: Parent Dad
Additional Member Function:
Private: default constructor
Public: constructor will have 2 input parent arguments for Mom and Dad
Additionally, Parents should be able to change Childs name
HINT: How can we change private variables in another class??
DATA:
Name | Homer | March | Lisa | Bart | Maggie |
Age | 36 | 34 | 12 | 10 | 3 |
Sex | M | F | F | M | F |
Work | Safety inspector | Housewife | Students | Student | Play |
(2)In Main (1)Create the Simpson family
(2) have Mach Set Maggies name
(3) Have Homer set Bart and Lisas name
(4) print out Homer, Lisa, and Maggies names, age, sex and work
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