Well, it means what it says - you are defining Statistics::Statistics(int*, int) twice - once in the class declaration, and once in your .cpp - remove the definition from the header and you're good.
I did remove the definition from header and I get a different error.
Statistics.cpp:106:1: error: prototype for ‘Statistics::Statistics()’ does not match any in class ‘Statistics’
Mode.h:41:30: error: candidates are: Statistics::Statistics(const Statistics&)
Mode.h:48:5: error: Statistics::Statistics(int*, int)
No, you didn't remove the definition in the header file. It's still there.
1 2 3 4 5 6 7 8 9 10 11 12 13
class Statistics:public Mode {
protected:
double sum;//Stores the sum of the array
double average;//Stores the average of the sum of array
int middle;//Store number of the array
float median;
public:
Statistics(int *a, int c): Mode(a, c)
{
sum=0;
average=0;
middle=0;
median=0;
And do you actually read these error messages? It says that this: Statistics::Statistics()
doesn't correspond to any method you declared in your class declaration.