mardi 27 février 2018

C++ dereferncing a instance variable pointer

Hello,

im trying to learn C++ at the moment but i'm struggeling with pointers i wrote a class for a simple list with the instance variables:

LinkedList *next;
int val;

However when i'm trying to dereference and get the value of next i get syntax error. The question is how can i derefernce the pointer correctly? If i don't use the pointer "this".

My try was:

LinkedList i;
i.*next;

and:

i.(*next);

Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire