class question?

Write your question here.

1
2
3
4
5
6
7
class Student
{
private:
int idnum;
string lastName;
double gradePointAverage;
};


The question is to add a public function voiddisplaystudentData. WOuld it look like this?
1
2
3
4
5
6
7
8
9
class Student
{
private:
int idnum;
string lastName;
double gradePointAverage;
public:
void displaystudentData(int,string,double)
};


So how would we implement said function?

nevermind I figure it out.
It woud look like this
1
2
3
4
5
6
7
8
9
10
11
12
class student
{
private:
int idnum;
string lastName;
double gradePointAverage;
public:
void displayStudentData()'


void Student :: displayStudentData
{cout <<"student last name""<lastName << "Id number"<< idNum <<endl;} 

Last edited on
Well, its not quite right. You forgot the parenthesis. It should look like this

1
2
3
4
void Student::displayStudentData()
{
     cout <<"student last name""<lastName << "Id number"<< idNum <<endl;
} 
void displayStudentData()'
void displayStudentData();
cout <<"student last name""<lastName << "Id number"<< idNum <<endl;
cout <<"student last name "<<lastName << "Id number "<< idNum <<endl;
Topic archived. No new replies allowed.