Please C Create Three Classes Human Parent Child Following Member Variables Member Functio Q37092196

Please C++

Create three classes Human, Parent and Childwith the following member variables and member functions andassociations:

ClassHuman                                                                                  

           Member Variables:

                                Private: stringname                                        

                                Private: intage                                                

                                Private: char sex         

           Member Functions:

                                Private: default constructor

                                Protected: constructor with three arguments: name, age, sex

                                Public: All setters and getters for member variables

                                Protected: Virtual~destructor              

Class Child

inherit class Human

Member Variables:

                                Private: string momName

                                Private: string dadName

                                Private: int allowance

Member Function:

                                Private: default constructor

Public: constructor has 5 inputargument, name, age, sex, momName and dadName. Initially setallowance to 0

Public: int getAllowance()const Prints allowance

                                Public: void printParent() Prints parent names

Recall, Parent should be able to changeChild allowance

                                HINT: How can we change private variables in another class??

                                               

Class Parent

inherit class Human

Member Variables:

Private: vector<string> children //save

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.