C 類模板實現順序棧

2021-06-01 14:08:38 字數 855 閱讀 3590

/*********************************棧的抽象類的定義****************************/

template class stack ;

/*******************************順序棧類的定義********************************/

#include "stack.h"

template class seqstack:public stack;

/*********************************順序棧類的實現******************************/

#include using namespace std;

template seqstack::seqstack(int initsize)

template bool seqstack::isempty()

template void seqstack::resize()

delete tmp;

}template void seqstack::push(const datatype& d)

data[++top_p] = d;

cout<< "\npush data success!\n";

}template datatype seqstack::pop()

return data[top_p--];

}template datatype seqstack::top()

return data[top_p];

}template seqstack::~seqstack()

順序表 C 類模板實現

include using namespace std define ok 1 define error 0 template class linklist int initlinklist linklist t l,int maxlistsize 100 初始化大小為100 int getleng...

C 模板實現順序表

pragma once include include include linearlist.h using namespace std const int defaultsize 100 templateclass seqlist public linearlist int size const ...

順序表C 模板實現

include using namespace std const int maxsize 20 template class sqlist template sqlist sqlist template sqlist sqlist template void sqlist creatlist t ...