Doctor::Doctor(const Doctor & rhs):speciality(rhs.speciality), visitFee(rhs.visitFee) { setSalary(rhs.getSalary()); setName(rhs.getName()); setSsn(rhs.getSsn()); setNetPay(rhs.getNetPay()); }
// Assignment operator uses Set methods to centralize // the memory management work. Student &Student::operator=(const Student &rhs) { setAge(rhs.mAge); setLast(rhs.mLastName); setFirst(rhs.mFirstName); setEmail(rhs.mEmail); setSsn(rhs.mSocial); return *this; }
Doctor & Doctor::operator=(const Doctor & rhs) { if (this == &rhs) return *this; else { speciality = rhs.speciality; visitFee = rhs.visitFee; setSalary(rhs.getSalary()); setName(rhs.getName()); setSsn(rhs.getSsn()); setNetPay(rhs.getNetPay()); return *this; } }
Student::Student( const int age, const char *last_name, const char *first_name, const char *email, const char social[]) : mAge(0), mLastName(0), mFirstName(0), mEmail(0) { mSocial[0] = 0; setAge(age); setLast(last_name); setFirst(first_name); setEmail(email); setSsn(social); }