I have a class named Student which looks like this
class Student
{ string name;
unsigned long int ID ;
string email;
unsigned short int year;
public :
Student() // Constructor
string getName(void);
unsigned long int getID(void);
string getEmail(void);
unsigned short int getYear(void);
{
and another class named eClass
class eClass
{
string eclass_name;
Student* students[100];
unsigned int student_count;
public:
eClass(string name)
{
student_count=0 ;
eclass_name = name ;
}
void add(Student& obj)
{
bool res = exists(Student obj); ****
if (res)
{
}
else
{
students[student_count] = obj ; ****
student_count++ ;
}
}
bool exists(Student &obj)
{
unsigned long int code = obj.getID(); ****
bool flag = FALSE ;
for (int i = 0 ; i<=student_count ; i++ )
{
unsigned long int st = students[i]->getID();
if (code==st)
{
flag = TRUE;
}
}
return flag;
}
};
It basically creates an object which represents a lesson and then adds students to the lesson via add() after it checks that the student does not already belong to the lesson.
I am getting an error at the lines I've marked with ****. Could someone help me what's going wrong...I'm not pretty sure I've understood how to use an object of a class in another one.