I've been trying to get this class to have a private array data member for the past hour, but it's refusing to work. I don't want to use array[5] mapArray; because then I don't get the array member functions.
Here is the code I am using at the moment.
#include "stdafx.h"
#include <iostream>
#include <array>
#include <fstream>
class Map {
public:
void scanFile();
private:
size_t columns = 20;
size_t rows = 20;
array <int, 5> mapArray;
};
int main() {
Map myMap;
}
And here are some example errors I am getting in Visual Studio.
1>x:\aerofs\gt\ece 2036\lab03\map.cpp(12): error C2143: syntax error : missing ';' before '<'
1>x:\aerofs\gt\ece 2036\lab03\map.cpp(12): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>x:\aerofs\gt\ece 2036\lab03\map.cpp(12): error C2238: unexpected token(s) preceding ';'
arrayclass is defined in thestdnamespace, so trystd::array.