Original Post
Hello,
i am currently working on a map for my text game and i ran into somewhat of a problem. In my map class, i have a const int row = 17; and const int column = 17; in the private data members section of the class. so when i go to compile it, i get a string of errors saying i need to have them as static to initialize them in the class header file. My question is why do they need to be static. i don't get the red error line under them when they don't have the static keyword. As i understand it, a static data member is the same for all instances, so does this effect my map if im only going to have one at all times. And if it does effect it, how to i change it to make it work. i have to have the Map array and all the constants in the header file so that the whole class can use them.
i am currently working on a map for my text game and i ran into somewhat of a problem. In my map class, i have a const int row = 17; and const int column = 17; in the private data members section of the class. so when i go to compile it, i get a string of errors saying i need to have them as static to initialize them in the class header file. My question is why do they need to be static. i don't get the red error line under them when they don't have the static keyword. As i understand it, a static data member is the same for all instances, so does this effect my map if im only going to have one at all times. And if it does effect it, how to i change it to make it work. i have to have the Map array and all the constants in the header file so that the whole class can use them.