// File: Senator.cpp // Implement Senator multiple inheritance class #include #include "PublicEmployee.h" #include "Politician.h" #include "Senator.h" using namespace std; Senator::Senator(const string &first,const string &last,const string &social, const string &place,int birthMonth,int birthDay,int birthYear,int term, int startMonth,int startDay,int startYear,GovernmentLevel entity,float amount): // Invoke both superclass constructors PublicEmployee(first,last,social,birthMonth,birthDay,birthYear,entity,amount), Politician(term,startMonth,startDay,startYear) {setState(place);} void Senator::setState(const string &place) { state=place;} void Senator::print(ostream &Dest) const { Dest << *this;} ostream& operator<<(ostream& Dest,const Senator &S) { // These pointers must be const. Why? const PublicEmployee *pubPtr=&S; const Politician *polPtr=&S; Dest << "Senator " << " of " << S.state << " " << *pubPtr << *polPtr << endl; return(Dest); }