Hi All,
I have created a class person and derived patient and doctor classes from person. Also I derived student_patient and emp_patient classes from patient class. I want to make a small calculation at patient, student_patient and emp_patient classes by using a function from doctor class wihch is get_fee_of_doc. I call get_fee_of_doc at other classes but I get errorC2352 . I tried to find the solution on the internet but I could not.
Can you please help me about this problem?
I appreciate for helps
Here declaration of classes:
class Patient: public Person
{
public:
Patient();
Patient(string name_of_patient, int age_of_patient, string address_of_pat, double visit_duration, string ssn_of_patient);
Patient(const Patient &p);
~Patient();
double get_visit_duration() const;
string get_ssn() const;
void set_ssn_(string ssn_ofp);
void set_visit_duration(double visit_duration_ofp);
virtual double billing() const;
void input(istream &inpa);
void output(ostream &outpa);
protected:
double visit_duration;
string ssn;
};
class Doctor: public Person
{
public:
Doctor();
Doctor(string name_of_doctor, double hour_fee_of_doc, long reg_number, string specialty);
Doctor(const Doctor &d);
~Doctor();
double get_fee_of_doc() const;
long get_regnum_of_doc() const;
string get_spec_of_doc() const;
void set_spec_of_doc(string specialty);
void set_fee_of_doc(double hour_fee);
void set_regnum_of_doc(long reg_num);
protected:
double doctor_hour_fee;
long doctor_reg_num;
string spacialty;
};
class Student_Patient: public Patient
{
Student_Patient();
Student_Patient(string name_of_student, int age_of_student, string address_of_student, double visit_of_stud, string ssn_of_student, string collage_of_student);
Student_Patient(const Student_Patient &s);
~Student_Patient();
string get_collage_of_stud() const;
void set_collage_of_student(string collage_ofs);
virtual double billing() const;
void input(istream &ins);
void output(ostream &outs);
protected:
string collage;
};
class Emp_Patient: public Patient
{
Emp_Patient();
Emp_Patient(string name_of_emp, int age_of_emp, string address_of_emp, double visit_of_emp, string ssn_of_emp, string department_of_emp);
~Emp_Patient();
string get_dep_of_emp() const;
void set_dep_of_emp(string dep_name);
virtual double billing() const;
void input(istream &ine);
void output(ostream &oute);
protected:
string department_name;
};
definition where I get error message:
double Patient::billing() const
{
return ((Doctor::get_fee_of_doc())*get_visit_duration());
}
definition of the function which I call:
double Doctor::get_fee_of_doc() const
{
return doctor_hour_fee;
}