I am trying to learn and implement classes and encountered this problem of implementing nested classes. I have implemented a version of it. I wanted to ask whether you would consider it a good example for nested classes? How can we achieve the same purpose without nesting these classes?
#include<iostream>
class Stack {
class Node {
public:
int data;
Node* next;
Node(int data, Node* next);
~Node();
}* head;
public:
Stack();
Stack(const Stack& s);
void operator=(const Stack& s);
~Stack();
void push(int data);
int peek() const;
int pop();
};