jeudi 30 novembre 2017

Trying to access a node's data data from inside the class but not in the node struct

I am trying to create a linked list using objects and i am not sure how to access the the data in the nodes. Right now the error that i am getting is that userId,userName, and userTime, all of the data in the nodes, are not declared in the scope. How can i fix this? thank you c++11

class labUsers
{

public:
labUsers() {head = 0;}
// mutators
void setID(int newID) {userID = newID;}
void setTS(int newTS) {userTime = newTS;}
void setName(std::string newName) {userName = newName;}
// accessors
void appendOne( int, int );
void insertOne( int, int, std::string, int, int );
// added these two (above) and the code below
// you need a display, delete, and search too

// old methods here....
int getUserID() {return userID;}
int getUserTS() {return userTime;}
std::string getName() {return userName;}
void create(labUsers*);
void logFileOn(int,int,std::string);
void logFileOff(int,int,std::string);

private:
 struct Node // node of linked lists
 {
    int userID;
    std::string userName;
    int userTime;
    struct Node * next;
 };
 Node *head; //points to the head
 ~labUsers();// destructor
 };

Aucun commentaire:

Enregistrer un commentaire