请问下面这段程序中的错误。。。(程序很短)
#include<iostream>
using namespace std;
class Student
{
public:
Student(int n,float s):num(n),score(s){}
void max(Student *p);
private:
int num;
float score;
};
void Student::max(Student *p)
{
float max_score=p[0].score;
for(int i=1;i<5;i++)
if(max_score<p[i].score)
{
max_score=p[i].score;
}
cout<<"maxscore="<<max_score;
}
int main()
{
void max(Student *p);
Student stu[5]={Student(101,34),Student(102,45),Student(103,22),Student(104,88),Student(105,44)};
Student *q=&stu[0];
max(q);
return 0;
}
程序链接过程中出错,经查,是因为在类Student的定义中有void max(Student *p);这个声明语句,那么请问大家一下,怎样在类定义中包含含有本类的声明语句呢?谢谢!