Hello
I am trying to create a linked list of the following style:
Code:
#include "variable.h" // CLASS called variable
struct node{
variable *objectPtr;
struct node *next;
};
typedef struct node nodeptr;
Basically, a pointer to an object and a pointer to the next node of the list. Is this the correct way of doing it?
I'm not sure how to set and access the object either. So far I have been trying this but it has not worked
Code:
ptr->objectPtr = new variable(VarID,constant);
Code:
cout << (ptr->objectPtr).GetVarID() << endl; //GetVarID() is a member function
Thanks for help