previous | start | next

Overloading operator<<: 4

Since operator<< for Employee must be a non-member function, it will not have direct access to the private data members unless we make it a friend!

    1   ostream& operator<<(ostream& os, const Employee& e)
    2   {
    3      os << "Name: " << e.getName() << endl;
    4      os << "SSN: " << e.getSSN() << endl;
    5      return os;
    6   }


previous | start | next