*********If my code below contains an error, you don't need to let me know. I just want
to know if I am on the right track*********
I have to do the following:
Make a linked list class (done for the most part).
Make a que class.
Right now inside the linked list class I have a stuct that contains the data and a pointer to the next node. I also have a pointer to a seperate Que class.
For the list:
struct ListNode
{
ListItemType name;
ListNode * forward;
ListNode * backward;
QueType * que;
};
class linkedList
{
public:
linkedList();
~linkedList();
void addLink(string);
void removeLink(string);
bool searchLink(string);
void compareLink(string);
bool isEmpty();
bool isFull();
void clearList();
private:
ListNode * circle;
};
For the Queue:
struct QueNode
{
ItemType data;
QueNode *link;
};
class Que
{
public:
Que();
Que(const Que &);
const Que &operator=(const Que &);
unsigned long lengthIs(void)const;
~Que();
void MakeEmpty();
bool IsEmpty()const;
bool IsFull()const;
void Enqueue(const ItemType &);
void Dequeue(ItemType &);
void debugPrint(std:
stream &)const;
void removeLast(ItemType &);
void switchFirstLast(void);
private:
QueNode *first;
QueNode *last;
unsigned long length;
};
Now my question is can I access the public member functions of the Que class from within member functions of the Linked List class without using inheritance?
For instance: circle->que->MakeEmpty();
I guess I'm being a bit dumb about this. If this makes any sense, some pointers would be appreciated.