I haven't programmed in C++ in forever and am really rusty. Help me out please? I've been tasked to develop a reversible singly linked listed but the nodes have to be declared in private. How do I access them to push/pop off my stack. Or am I going about this wrong?
#include <iostream>
using namespace std;
class ReversibleStack
{
public:
void push(int item);
int pop();
bool IsEmpty();
void Reverse();
private:
// let's build our singly linked list in private
typedef struct node
{
int first; //the first node
node *next; //pointer to the next node available
}node;
};
#include "ReversibleStack.h"
#include <iostream>
using namespace std;
//This is the Push function that pushes an item onto the stack
void Push(int Item)
{
node* current = first; // sets current pointer to first
node* new_item = Item; // sets previous pointer to NULL
node* next = current->next; // next item in stack
}