I want to get data from an objects array and print it using "cout". Having trouble figuring out how to implement this. I have an array of pointers "classRosterArray" that point to student objects. I must use the "GetCourseDays()" method to get the data as the "courseDays[]" variable is private to the Student class.
Student.cpp
1 2 3
int Student::GetCourseDays() {
return courseDays[0], courseDays[1], courseDays[2];
}
You can't return multiple things from a function. That isn't what the comma operator does.
I think you're over-restricting yourself here.
You can have the class itself handle printing to a stream:
> Why is your Student object called a 'classRosterArray'. That doesn't make sense to me
ah, but it is not an object, you see, but a pointer
although that only gives more questions.