|
|
|
|
复制本帖HTML代码
|
高亮:
今天贴
X 昨天贴
X 前天贴
X |
1. null 必须大写,也就是 NULL;
2. 类tristStack还没定义,所以不能用;可用指针.
下面是改过的程序:
//tristStack.h
#ifndef _TRISTSTACK_H_INCLUDE
#define _TRISTSTACK_H_INCLUDE
#include "Trist.h"
class tristStack {
public:
tristStack();
~tristStack();
void pushTrist (Trist t);
Trist popTrist ();
bool isEmpty();
int getSize();
Trist head;
void * next;
int size;
};
#endif
//tristStack.cpp
#include "tristStack.h"
tristStack::tristStack() {
head = Trist();
next = NULL;
size=0;
}
tristStack::~tristStack() {
}
bool tristStack::isEmpty () {
if (size == 0)
return true;
return false;
}
int tristStack::getSize() {
return size;
}
void tristStack::pushTrist(Trist t){
next = this;
head = t;
size++;
}
Trist tristStack::popTrist() {
Trist temp = head;
head = ((tristStack *)next)->head;
next = ((tristStack *)next)->next;
size--;
return temp;
}
.
|
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法! |
Put your OWN COOL signature here!
|
|