well i need to make a class called TList which have a private attribute and a counter
private:
TPerson **pListe;
int counter;
TPerson is another class i made before. counter is to know the position of the array.
So i need to create a List which have methods like
Add(TPerson *p), Delete(TPerson *p)
Now my problem is:
how can i add those TPerson objects to my double pointer list?
i’ve my
void TListe::Add(TPerson &p) {...}
method.
i tryed it like that:
pListe[counter] = &p;
for example and it doesnt work.. can somebody explain me how i need to work with double pointer arrays and use them as lists?
greetings
I’m confused by your code example ,
*pListeis going to hold pointer to first element of array ofTPersonobjects, or just pointer toTPerson?. I think you you need to first allocate array of pointers to person :then you can do: