我需要一些帮助:我被要求对 2 个堆栈的比较运算符进行一些重载。我已经弄清楚了语法,我只是在编写定义时遇到了麻烦。所以请帮助我。
至少一个运算符重载,然后我会为其余的。
struct linklist
{
int no;
struct linklist *next;
};
class Stack
{
private:
linklist *list,*head;
public://constructor and destructor
Stack();
~Stack();
public:// main functions
void push();
void show();
void pop();
public://overloaded operations
friend bool operator == (const Stack &stack1, const Stack &stack2);
friend bool operator != (const Stack &stack1, const Stack &stack2);
friend bool operator < (const Stack &stack1, const Stack &stack2);
friend bool operator > (const Stack &stack1, const Stack &stack2);
};