Extend the patient class to include the following data members and methods i.e., INHERITANCE. DEFINE AND IMPLEMENT (write the code for) the extended class. Class will be a name of your choice.   Member variable medical record number (i.e., the identifier of the last hospital providing care). Include member method includes, prototypes (declaration) and code (definition): all constructor(s), set medical record number and print to extend the base class patient. Create an object of the inherited class that sets all member variables to values of your choice, i.e., use the extended class as you would in a test/client program. You do not need to write any other code in the test/client

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 6E
icon
Related questions
Question
100%

C++ language

patient.h

/*preventing multiple inclusion of header files using
#ifndef and #define directives */
#ifndef PATIENT_H
#define PATIENT_H
#include<iostream>
using namespace std;
class patient
{
   //declaring instance variables
   private:
       string firstName;
       string lastName;
       int id;
   public:
       //default constructor declaration
       patient();
       //parameterized constructor declaration
       patient(string fName,string lName,int pId);
       //print() function declaration
       void print();
       //setter functions declaration
       void setFirstName(string fName);
       void setLastName(string lName);
       void setId(int pId);
};
#endif

patient class implementation

patient.cpp

#include "patient.h"
//default constructor implementation
patient::patient()
{
   firstName="";
   lastName="";
   id=0;
}
//parameterized constructor implementation
patient::patient(string fName,string lName,int pId)
{
   firstName=fName;
   lastName=lName;
   id=pId;
}
//print function implementation
void patient:: print()
{
   cout<<"First Name: "<<firstName<<endl;
   cout<<"Second Name: "<<lastName<<endl;
   cout<<"ID: "<<id<<endl;
}
//setter method to set firstName implementation
void patient::setFirstName(string fName)
{
   firstName=fName;
}
//setter method to set lastName implementation
void patient::setLastName(string lName)
{
   lastName=lName;
}
//setter method to set id implementation
void patient::setId(int pId)
{
   id=pId;
}

 

  1. Extend the patient class to include the following data members and methods i.e., INHERITANCEDEFINE AND IMPLEMENT (write the code for) the extended class. Class will be a name of your choice.

 

  1. Member variable medical record number (i.e., the identifier of the last hospital providing care).
  2. Include member method includes, prototypes (declaration) and code (definition): all constructor(s), set medical record number and print to extend the base class patient.
  3. Create an object of the inherited class that sets all member variables to values of your choice, i.e., use the extended class as you would in a test/client program. You do not need to write any other code in the test/client
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr