I have "This declaration has no storage class or type specifier" error in Visual Studio than I try to initialize my array with functions. I'm declare an array in header:
typedef void (*MultimethodFunc)(ofstream& out);
extern MultimethodFunc multimethodFunc[][10];
In .cpp file I have this:
MultimethodFunc multimethodFunc[10][10];
And finally I try to initialize it in another .cpp:
void TrainTrainOut(ofstream& out) {
out << "\nTrain and Train" << endl;
}
void MMTrainTrainOut(ofstream& out) {
return TrainTrainOut(out);
}
multimethodFunc[1][1] = MMTrainTrainOut;
multimethodFunc[1][2] = MMTrainAirplaneOut;
multimethodFunc[2][1] = MMAirplaneTrainOut;
multimethodFunc[2][2] = MMAirplaneAirplaneOut;
Another functions just similar to TrainTrainOut and MMTrainTrainOut with different outs and matching returns. The error is placed in last strings there I try to assign functions to arrray. What I'm doing wrong in this case? Thank you!
MultimethodFunc muntimethodFunc[10][10] = { /* values here */ };that would be an initialization.