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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!