Question: In C++ write a program , Lab10.cpp is given Lab10.cpp: #include #include using namespace std; // Base class personType class personType { public: void print()const;

In C++ write a program ,
Lab10.cpp is given  In C++ write a program , Lab10.cpp is given Lab10.cpp: #include
#include using namespace std; // Base class personType class personType { public:
Lab10.cpp:
#include
#include
using namespace std;
// Base class personType
class personType
{
public:
void print()const;
//Function to output the first name and last name
//in the form firstName lastName.
void setName(string first, string last);
string getFirstName()const;
string getLastName()const;
personType(string first = "", string last = "");
//Constructor
//Sets firstName and lastName according to the parameters.
//The default values of the parameters are null strings.
//Postcondition: firstName = first; lastName = last
private:
string firstName; //variable to store the first name
string lastName; //variable to store the last name
};
void personType::print() const
{
cout
}
void personType::setName(string first, string last)
{
firstName = first;
lastName = last;
}
string personType::getFirstName() const
{
return firstName;
}
string personType::getLastName() const
{
return lastName;
}
//constructor
personType::personType(string first, string last)
{
firstName = first;
lastName = last;
}
// --------------------Start your code from here
//--------------------driver program
int main()
{
personType person1("Lisa", "Regan");
doctorType doctor1("Sarah", "Conner", "Dentist");
patientType patient1("Sam", "Fire",200,100,1916);
billType b1(doctor1, patient1);
b1.setCharge(250.66);
cout Printing... ";
person1.print();
cout
cout Printing... ";
doctor1.print();
cout
cout Printing... ";
patient1.print();
cout
cout Printing... ";
b1.print();
cout
return 0;
}
Download Lab10.cpp. In this file, the definition of the class personType has given. Think of the personType as the base class. Questionl (Inheritance) Type, with an additional class Derive the class doctorType, inherited from the class member variable member to store a doctor's specialty(string type) Then, implement following class member function prototypes. person doctorType(string.string.string)://Firstname Lastname Specialty doctorTypeO:l/Default constructor void setSpecialty(string):l/Set doctor specialty string getSpecialtyOconst:// Get doctor specialty void printOconst://Display doctor information the same as given output format Derive the class patientType, inherited from the class personType, with additional class member variables to store a patient's id, age, and dob (all are integers). Then, implement following class member function prototypes patient Typelstring, string, int, int, int)://Firstname Lastname id age dob patient TypeO:Default constructor void setld(int)://Set patient id void setage(int):l/Set patient age void setDobfint);Set patient DOB int getld0constl/Get patient id int getageOconst://Get patient int getDobOconst://Get patient DOB void print const;/Display patient information the same as given output format

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!