Here is the class type for persomType from chapter 12 So if
Here is the class type for persomType from chapter 12. So if u see chapter 12 it means u have to use this class. Please answer ques 1A and Ques 1B only
class PersonType{
public:
void print() const;
void setName(string first, string last);
string getFirstName() const;
string getLastName() const;
PersonType(string first = \"\", string last = \"\");
private:
string firstName;
string lastName;
};
Solution
==========================================================
--------------
Answer:
--------------
Given PersonType class
class PersonType{
public:
void print() const;
void setName(string first, string last);
string getFirstName() const;
string getLastName() const;
PersonType(string first = \"\", string last = \"\");
private:
string firstName;
string lastName;
};
---------------
1A Answer:
---------------
//class defination for doctorType
class doctorType : public personType
{
private:
string speciality;
public:
doctorType(string speciality=\"\");
string getSpeciality() const;
void setSpeciality(string specialityParam);
};
//constructor
doctorType::doctorType(string speciality=\"\") {
this->speciality = speciality;
}
//getter method for setSpeciality
string doctorType::getSpeciality() const {
return speciality;
}
//setter method for speciality
void setSpeciality(string specialityParam) {
speciality = specialityParam;
}
---------------
1B Answer:
---------------
//class defination for doctorType
class patientType : public personType
{
private:
string ID;
int age;
string DOB;
public:
patientType(string ID=\"\",int age=\"\",int DOB=\"\");
string getID() const;
int getAge() const;
string getDOB() const;
void setID(string ID);
void setAge(int age);
void setDOB(string DOB);
};
//constructor
patientType::patientType(string ID=\"\",int age=\"\",int DOB=\"\") {
this->ID=ID;
this->age=age;
this->DOB=DOB;
}
//getter method for getID
string patientType::getID() const {
return ID;
}
//getter method for getAge
string patientType::getAge() const {
return age;
}
//getter method for getDOB
string patientType::getDOB() const {
return DOB;
}
//setter method for ID
void patientType::setID(string IDParam) {
ID = IDParam;
}
//setter method for Age
void patientType::setAge(int ageParam) {
age = ageParam;
}
//setter method for Age
void patientType::setDOB(int DOBParam) {
DOB = DOBParam;
}
==========================================================


