PDA

View Full Version : Problemi con le classi (C++)


agus83
09-06-2008, 16:14
Ciao a tutti!!!
Vi posto un mio problema con i puntatori in C++ che mi sta facendo sclerare!Metto sotto il codice di esempio:

/*---------file header----------------------

#include <iostream.h>
using namespace std;
#define N 5

class SlotTableEntry{
public:
char sti;
char PSF : 2;

SlotTableEntry(){
sti = 0;
PSF = 0;
};
};

class FI{
public:
SlotTableEntry slots[N];
inline SlotTableEntry getSlot(int index){ return slots[index];};
};

class SlotTable {
public:
FI* fi_table[N];

FI* getChannelStatus();
};

/*-------------------------------------

Nel file sorgente .cpp faccio semplicemente:

main()
{
SlotTable tabella;
SlotTable tabella2;
tabella.fi_table.slots[1].sti = 'a';
// qui ottengo errore su "slots"
}

Come faccio ad accedere in maniera corretta a tale variabile?
Grazie per l'help :D

agus83
09-06-2008, 16:44
L'errore è su slots: 'slots' has not been declared
Penso che non accedo in modo corretto...non è ho proprio idea!
Come faccio adesso a mettere il tag sul codice?Scusate per i casini,ma sono praticamente nuovo del forum

VICIUS
09-06-2008, 17:31
Chiuso.
http://www.hwupgrade.it/forum/showthread.php?t=1649196