I know the basic way to initialize arrays.I get an error on my compiler about an int array i what to initialize on a constructor that i do not understand it.I need some help. my code is:
Cpp file:
#include <iostream>
using namespace std;
#include "ValidationController.h"
ValidationController::ValidationController() {
// TODO Auto-generated constructor stub
monthTable[12]={0,3,3,6,1,4,6,2,5,0,3,5};
}
ValidationController::~ValidationController() {
// TODO Auto-generated destructor stub
}
and the header file:
#ifndef VALIDATIONCONTROLLER_H_
#define VALIDATIONCONTROLLER_H_
class ValidationController {
public:
int monthTable[];//={0,3,3,6,1,4,6,2,5,0,3,5};
ValidationController();
virtual ~ValidationController();
};
#endif /* VALIDATIONCONTROLLER_H_ */
the error i get is:
..\src\ValidationController.cpp:13: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11 [enabled by default]
and
..\src\ValidationController.cpp:13: error: cannot convert '' to 'int' in assignment
I do not want to make it static. Is the there any solution that keeps the declaration to the header file?Or should i just declare it and initialize it in the .cpp file at once after imports.