The problem is in this case, that if you define an array, the default constructor ( student()) will have already been called, so you are actually trying to instantiate an already existing instance. Instead, declare pointers to your instances and instanciate them together with the new operator:
1 2
|
student* array[size];
new array[0](90,91);
|
Ok, for your code to work:
Declare the parameter of your function as a reference instead of a value:
void BubbleSort(EECE230Student &a[])
Otherwise, a copy of your array will be edited, not the array itself.
Also, BubbleSort must be declared before the main function, this error message reads as if you accidentally declared it inside of it.
Do these changes, and tell me what comes out of it.
Oh and I think array is a reserved word.