Question: PLEASE HELPPPPPPP!!!! Below are 4 classes and their inheritance relationships for questions 30a and 30b . Class Grandfather - Private Data : Integer age =
PLEASE HELPPPPPPP!!!!
Below are 4 classes and their inheritance relationships for questions 30a and 30b.
Class Grandfather - Private Data : Integer age = 8; FamilyDNA = "GTCGTTCGGAATGCCGTTGCTCTGTAAA"
Class Father - Private Data : Integer age = 50; Class Father has a Public inheritance relationship with Grandfather
Class Mother - Private Data : Integer age = 46; Class Mother has a Public inheritance relationship with Grandfather
Class Son - Private Data : Integer age = 20; Class Son has a Public inheritance relationship with Father and Mother
30a)
- Identify the type of inheritance
- Do you see any issues with this inheritance? If any, what is the problem and how do you solve the problem?
30b)
Use the code framework to complete the program to display the family DNA and result of the average age from the 4 classes. Initialization of data can only be done in a class default constructor. Only the Son class can have an object. References to data members and any calls to member functions are through the Son object (John).
#include
using namespace std;
//declare class Grandfather
class Grand.........{
//declare and define the function to display Family DNA - make it a void function to save time
void DisplayDNA(){
} };
//declare class Father
class Father... {
};
//declare class Mother
class Mother... {
};
//declare class Son
class Son... {
};
int main() {
//You can only create an object from the Son class
Son John;
John.displayDNA();
//Avearge age for the entire generation must be calculated here.
cout << "Average Age : " << ..........
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
