Hi,
Can someone explain to me the following error:
"no matching function for call to 'Student::Student(Student)'"
i got the message only in the return statement. (line 4)
What you had before, i.e. Student(Student&); is a copy constructor that takes a non-const reference. This is possible to have but there is a problem when it comes to temporary objects, namely that non-const references cannot bind to them. This means that the call to return Student (*(this->student)); was looking for a function that took in a Student because the copy-constructor you had could not be used in that situation. Making the copy constructor take in a const reference allowed it to handle the *(this->student) argument correctly.