Using the information given above, create the following three classes. a. A parent class named Person containing common data members and functionality of the child classes; Doctor and Patient b. The class Doctor which is publicly inherited from the class Person c. The class Patient which is publicly inherited from the class Person Each class must contain at least two constructors in addition to the appropriate set() and show() functions. Functions of child classes should call appropriate functions of the parent class to perform the common functionality. All the function definitions should be written inside the class. Also provide a suitable main function to demonstrate the creation and usage of different objects of child classes

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 39SA
icon
Related questions
Question

Suppose, we have two related (child) classes named Doctor and Patient. Data members
required by each class are given below.

data members of doctors

name type remarks
name string full name  of doctor
age int age of person
spec string speialization of doctor
     

 

data members of patient 

name type remarks
name string full name of person
age int age of he person
diag string diagnosed problem

Using the information given above, create the following three classes.


a. A parent class named Person containing common data members and functionality of
the child classes; Doctor and Patient
b. The class Doctor which is publicly inherited from the class Person
c. The class Patient which is publicly inherited from the class Person


Each class must contain at least two constructors in addition to the appropriate set() and show() functions. Functions of child classes should call appropriate functions of the parent class to perform the common functionality. All the function definitions should be written inside the class. Also provide a suitable main function to demonstrate the creation and
usage of different objects of child classes

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
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++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning