title: Using an object of a class in another class
body: <p>I have a class named Student which looks like this</p>
  
  <pre><code>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);   
  {
  </code></pre>
  
  <p>and another class named eClass</p>
  
  <pre><code>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&amp; obj)
          {
              bool res = exists(Student obj);  ****
              if (res)
              {
              }
              else
              {
                  students[student_count] = obj ;  **** 
                  student_count++ ; 
              }
          }
  
          bool exists(Student &amp;obj)
          {
              unsigned long int code = obj.getID(); ****
              bool flag = FALSE ;
              for (int i = 0 ; i&lt;=student_count ; i++ )
              {
                  unsigned long int st = students[i]-&gt;getID();
                  if (code==st)
                  {
                      flag = TRUE;
                  }
              }
              return flag;
          }
      };
  </code></pre>
  
  <p>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. </p>
  
  <p>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. </p>