I don't see where you have changed int to vehicle in the code example. Do you actually understand what is meant by changing the data type of the node ? at current the node class is storing pointer to data of type Integer.
Here is what the modified classes look like now.
#include "vehicle.h"
//forward declaration
class Node;
//class definition
class LinkedList
{
public:
//construction
LinkedList();
//add a new node to the last
void addToList(Vehicle *data);
//find an element in list and set current pointer
void find( int key);
//get data from element pointed at by current pointer
Vehicle* getCurrent(void);
//delete element pointed at by current pointer
void deleteCurrent(void);
private:
//data members
Node *_begin; //pointer to first element in list
Node *_end; //pointer to last element in list
Node *_current; //pointer to current element in list
};
class Node
{
public:
//construction and destruction
Node();
~Node();
//to set and get the next node in the list
void setNextNode(Node *next);
Node* getNextNode(void);
//to set and get the previous node in the list
void setPrevNode(Node *next);
Node* getPrevNode(void);
//to set and access data hold in node
void setData(Vehicle *data);
Vehicle* getData(void);
private:
//data members
Node *_next; //pointer to next node in list
Node *_prev; //pointer to previous node in list
Vehicle *_data; //pointer to data hold in node
};
notice the data variable in the node class is now a pointer of type Vehicle, and that the declarations of the accessor and mutator member functions have been changed to accordingly.
I'll leave you to figure out what needs to be done in the definitions of the linked list and nodes member functions, as I don't want to be doing all your homework for you.
