Advertisement
carlos1993

studentType

Feb 9th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include "personType.h"
  2. #include <string>
  3. #include <sstream>
  4.  
  5. class studentType : public personType {
  6.     friend ostream& operator<<(ostream&, studentType&);
  7.     friend istream& operator>>(istream&, studentType &);
  8. protected:
  9.     string department;
  10. public:
  11.  
  12.     studenType(int ssn, nameType n, dateType date, string dpt)
  13.     : personType(ssn, n, date, dpt) {
  14.         this->department = dpt;
  15.     }
  16.     string getStudentStringInfo(){
  17.         stringstream ss;
  18.         ss << s.name << " " << s.birthDate << " " << s.SSN << s.department;
  19.         return ss.str();
  20.     }
  21. };
  22.  
  23. ostream& operator<<(ostream& os, studentType& s) {
  24.     os << s.name << " " << s.birthDate << " " << s.SSN << s.department << endl;
  25.     return os;
  26. }
  27.  
  28. istream& operator>>(istream& is, studentType& s) {
  29.     cout << "Please enter the name (first & last), the birth date (MM/DD/YYYY) and the SSN and department:" << endl;
  30.     is >> s.name;
  31.     is >> s.birthDate;
  32.     is >> s.SSN;
  33.     is >> s.department;
  34.     return is;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement