Declare your Department class before it’s called in College. (Move your Department declaration above your College declaration):
class Department
{
public:
string name;
int numOfStudents;
Department* next;
Department(){name[0] ; numOfStudents=0 ; next=NULL ;}
Department( string n , int numS){ name =" "; n ;numOfStudents = numS ; next=NULL;}
void Print(){cout<<name<<" "<<numOfStudents;}
};
class College{
public :
string name; //for name of the college
int numOfColleges;
int numDepartments; //number of departments in this college
Department * dep; //this will point to the department in this college
College * next; //the next pointer to point to the next college
College(){
name =" ";
numDepartments=0 ;
dep = NULL;
next=NULL;}
College (string n, int numD ){name=n ;next=NULL;}
void Print(){
cout<<name<<"\n";
}
};