Question: A struct called Person that has the components first and last ( of type string ) . A class called Doctor with the private data
A struct called Person that has the components first and last of type string
A class called Doctor with the private data members name of type Person degree of type string
and salary of type integer The class has the public member functions set getSalary print and a
default parameterize constructor.
Define a class called Master which publicly inherits the class Doctor and has the private data
members specialty of type string rarity and salary both of type integer The class has the public
member functions set print findSalary and a default parameterize constructor.
The overall salary of a Master is the sum of rarity and the salary of a Doctor.
Implement the member functions of both classes. Use one header file, one implementation file, and one
driver file.
The following driver produces the given output:
int
Master
Omar.setAli "Omar", "Dermatologist", "Pathologists", ;
Omar.print:
return
Sample output:
Dr Ali Omar has a Dermatologist degree and hisher salary is
HeShe is specialized in Pathologists and hisher total salary is
The first line of the above output is produced by the print function of the class Doctor.
The implementations of the following functions are given:
int Doctor::getSalary const
return salary:
void Doctor::print const
cout Dr name.first
degree degree and hisher salary is salary endl;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
