Hello I'm getting 2 errors

c:\computer science programming\excerise sheet 4\student\student.h(8) : error C2629: unexpected 'class Student ('
c:\computer science programming\excerise sheet 4\student\student.h(8) : error C2238: unexpected token(s) preceding ';'

heres the student class:

#ifndef STUDENT_H
#define STUDENT_H

class Student
{
public:

Student(const char *, const Date &);

void printStudent();
char * getname();
void print();

private:

   char name[10];
   const birthDate;


};

#endif

and its def

#include <iostream>
#include <cstring>

using namespace std;

#include "student.h"
#include "date.h"

Student::Student( const char * surname, const Date &dateOfBirth):birthDate(dateOfBirth)
{
strcpy(name , surname);
}

void Student::printStudent()
{
   cout << "The students name is : "<< name << endl;
}

char * Student:: getname()
{
   return  name;
}

void Student::print()
{
cout << "The students information is: " ;
birthDate.print();

}

A Student needs to know what a Date is. Perhaps put the inclusion of "date.h" into "student.h", or change the order of inclusion in your module.

umm, that compiles but doesnt run:

C:\computer science programming\excerise sheet 4\Student\student1.cpp(27) : error C2662: 'print' : cannot convert 'this' pointer from 'const class Date' to 'class Date &'

This article has been dead for over six months. Start a new discussion instead.