A multitude of errors, mostly caused by trying to write everything in on go.
(a) Patient includes an instance to Doctor. Therefore you must have a declaration of Doctor before Patient is declared. If it was just a reference or pointer you could have used a forward declaration e.g class Doctor;
BUT you can't in this instance.
(b) Lots of typos. you use doc to mean doctor etc e.g. in the copy constructor for Patient. You write doctor1() in the main() { } section.
(c) Failure to call the base constructor in derived constructors and in the assignment operator.
(d) Lots of inconsitancy in format/layout which itself is not wrong but makes it difficult to see what is going on. For beginners I would recommend:
(i) Never use using namespace std;
(ii) Don't put names of variables within declarations.
(iii) Consistent set/get naming so it is clear
(iv) copy Constructors are build like this e.g.
Doctor::Doctor(const Doctor& A) : Person(A),
hour_fee(A.hour_fee),reg_num(A.reg_num)
{}
and the assignment operator like this
Doctor&
Doctor::Doctor(const Doctor& A)
{
if (this!=&A)
{
Person::operator=(A);
hour_fee=A.hour_fee;
reg_num=A.reg_num;
}
return *this;
}
(v) Don't use a general protected, if that is what you have then change your model to a pure virtual inheritance.
(vi) Validate input.