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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education