I have a problem in using an array of pointers, I need to create an array with pointers that refer to an integer value of each object of another class.
Example:
arrayDePonteiros[0] = objeto.int;
In case this array is inside a class and as it will be only a reference it will be static, so I can use this array to refer to the value of each object of the other class, which will be recorded in an eeprom in the future. When I read the value in eeprom I can use the pointer to pass the eeprom value to the object variable.
My current code is:
class Scenario {
public:
int byteInicial; // byte da eeprom
static int* link[6]; // atual array de ponteiros
Scenario(int byteI) // construtor da classe
{
byteInicial = byteI;
link[0] = &led1.fade;
}
In this case I get the error: undefined reference to 'Scenario :: link'. I've already tried using
Scenario::Scenario link [0] = &led1.fade;
But I get the error trying to use it anyway, either by printing on the serial or trying to write to eeprom. What would be the right way to do this?