hospital
hi I have to create a hospital file and I have problems implementing my add doctor functions
here is my doctor.h file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
*
* doctor.h
*
* Created on: Feb 15, 2014
* Author:
*/
#ifndef DOCTOR_H_
#define DOCTOR_H_
#include<string>
#include<iostream>
using namespace std;
class doctor{
private:
string doctorName;
int doctorId;
string doctorAddress;
string doctorTel;
string doctorRank;
// patient*patientList= NULL;
public:
doctor();
doctor(){
patientList= new Patient[4]
};
doctor(int,string, string, string, string );
~doctor();// remeber to delete patient array
void setDoctorName(string name);
void settName(string doctorName);
void setName(int doctorId);
void setAddress(string doctorAddress);
void setTel(string doctorTel);
void setRank(string doctorRank);
void addDoctor();
};
#endif /* DOCTOR_H_ */
|
and here is my doctor.cpp file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/*
* doctor.cpp
*
* Created on: Feb 15, 2014
* Author:
*/
#include "doctor.h"
#include "patient.h"
doctor::doctor(){
doctorName="";
doctorId=0;
doctorAddress="";
doctorTel="";
doctorRank="";
}
doctor::doctor(string nam, int id,string adr,string tel,string ran){
doctorName= nam;
doctorId= id;
doctorAddress="";
doctorTel="";
doctorRank="";
}
void doctor::settName(string doctorName){
this->doctorName= doctorName;
}
void doctor::setName(int doctorId){
this->doctorId=doctorId;
}
void doctor::setAddress(string doctorAddress){
this->doctorAddress=doctorAddress;
}
void doctor::setTel(string doctorTel)
{
this->doctorTel=doctorTel;
}
void doctor::setRank(string doctorRank){
this->doctorRank=doctorRank;
}
void doctor::addDoctor(){
}
doctor::~doctor() {
// TODO Auto-generated destructor stub
};
|
Why does a Doctor class have an addDoctor function? What is this function's purpose?
Also, you have two conflicting constructors. Depending on which one is kept, you also need to make sure you free any dynamically allocated memory.
Topic archived. No new replies allowed.