/* student.cpp */ #include #include "student.h" using namespace std; // This definition of the operator << allows us // to output conveniently student objects. ostream& operator<<(ostream& out, const Student a) { out << '{' << a.mid << ", " << a.final << ", " << a.hmws << "}\n"; return out; } // This definition of the operator >> allows us // to input conveniently student objects. istream& operator>>(istream& in, Student a) { in >> a.mid >> a.final >> a.hmws; return in; } // We cannot compare directly two students (i.e. we cannot say (sam == tom)], // but we can extend the definition of == to make it possible. bool Student::operator==(const Student& a) const { return (a.mid == mid && a.final == final && a.hmws == hmws); }