class Group
{public:
Group(Students *array[], int size); // This is actually an "array of
// pointers" to Students, not
// an array of Students
};
int main()
{
int number = 9;
Students students[number]; // The size of an array in standard C++ must
// be a constant value. This is a variable
// length array issue, which C++ doesn't support
Group group(students, number); // Build failed for three reasons.
// 1) Because array size wasn't a constant value.
// 2) Because the first constructor argument is the wrong type.
// 3) You're trying to call a constructor which has not been defined
return 0;
}
To get this to work the way you want to there are three changes you need to make:
class Group
{public:
Group(Students array[], int size){} // Now it's an array of Students
// Also note it has squiggly
// brackets after it, that means it
// has a definition
};
int main()
{
const int number = 9; // Array size is now a constant
Students students[number];
Group group(students, number); // Now you can call the constructor because
// it's been defined
return 0;
}