How to implement the operator for the class:
Department operator+=(Course &); The class itself:
using namespace std; class Student; class Course; class Department { // overload input output streams friend ostream &operator<<(ostream &, const Department &); friend istream &operator>>(istream &, Department &); private: string name; long id; Course** coursesOfDepartment; // list of pointers course in this department Student** studendOfDepartment; // list of pointers studetns of this department Student** badStudentsOfDepartment; // list of point students by the course points < 65 public: static int departmentsCounter; // count num of elements Department(); // set get block void setId(long); void setName(string); string getName() { return name; } long getId() { return id; } // overload block Department &operator=(const Department &); // instead copy constructor bool operator>(const Department &) const; // check if count of students greater than count of students in another department Department operator+=(Course &); // add new course to to the department list Department operator+=(Student &); // add new student to to the department list ~Department(); }; In the operator, you need to create a new object of the Course class and add it to the Course** coursesOfDepartment array Course** coursesOfDepartment .
main, sorry? - VladD