Hi to all. :)
I need to create a bidimensional vector and work on it like a bidimensional array. I don't find any example of code and all the implementations of vectors I've seen are in only one dimension. But if it is one of the most powerful data structures of C++ I think I can make it in 2 dimensions.
For the first time I am at work to make a program with classes.
I've tried to declare an int variable in one class and initialize it in the costructor of the class, but compiler give a linking error:
[Linker error] undefined reference to `number'
I can't set the value of the variable in any part of the program, neither in the constructor, neither in standard metods, neither in the main. :(
I really don't know where is the error:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
class snake{
public:
snake();
int stampaSnake(int righe);
static const int COLONNE = 4;
static int number;
};
snake::snake()
{
int a =0;
int righe = 4;
number=4; //error
}
|
if I remove the row "number=4;" the program works correctly. But I need this variable. :(
Thanks for reading!! :)
PS. I'm using Dev-C++ 4.9.9.2
Thanks again.