Creating a stack with variable of class list
I made a Class List with inherence to SinglyLinkedList. Lists can insert
and remove. Those functions all work properly. Now I want to make a stack,
using a SinglyLinkedList.
How to create a object Stack with a new clean SinglyLinkedList and so I
can access the insert en remove function from that list? I tried it like
this, but kind of failed. Searched it on Google but didn't know where to
find it.
File: Stack.h
#ifndef Stack_h
#define Stack_h
#include "SinglyLinkedList.h"
class SinglyLinkedList;
class Stack{
public:
Stack();
bool push(const SinglyLinkedList & l);
int pop(const SinglyLinkedList & l);
bool empty(const SinglyLinkedList & l);
private:
SinglyLinkedList list;
};
No comments:
Post a Comment