C++数据结构代码!请问下面的错误是什么意思? 5
template<classTelem>classSqList:publicList<Telem>{private:SqList(intmaxsz=100):maxlen...
template<class Telem>
class SqList:public List<Telem> {
private:
SqList(int maxsz=100):maxlen(maxsz) {
curlen=0;
Telem & elem;
int curlen;
int maxlen;
public:
elem= new Telem[maxlen];
}
SqList(Telem a[],int n,int maxsz=100):maxlen(maxsz) {
curlen=n;
elem=new Telem[maxlen];
for(int i=0;i<n;i++) elem[i]=a[i];
}
#include "stdafx.h"
#include "SqList.h"
#include<iostream>
using namespace std;
void main() {
char a[]={'a','b','c','d','e'};
SqList <char> sql1(a,5); //这里的问题
for(int i=1;i<=5;i++) cout<<sql1.gete(i)<<" ";
cout<<endl;
sql1.inver();
for(int i=1;i<=5;i++) cout<<sql1.gete(i)<<" ";
}
List.cpp
H:\PROGRAM FILES\VC6\MYPROJECTS\LESSON2\List\List.cpp(11) : error C2259: 'SqList<char>' : cannot instantiate abstract class due to following members: 展开
class SqList:public List<Telem> {
private:
SqList(int maxsz=100):maxlen(maxsz) {
curlen=0;
Telem & elem;
int curlen;
int maxlen;
public:
elem= new Telem[maxlen];
}
SqList(Telem a[],int n,int maxsz=100):maxlen(maxsz) {
curlen=n;
elem=new Telem[maxlen];
for(int i=0;i<n;i++) elem[i]=a[i];
}
#include "stdafx.h"
#include "SqList.h"
#include<iostream>
using namespace std;
void main() {
char a[]={'a','b','c','d','e'};
SqList <char> sql1(a,5); //这里的问题
for(int i=1;i<=5;i++) cout<<sql1.gete(i)<<" ";
cout<<endl;
sql1.inver();
for(int i=1;i<=5;i++) cout<<sql1.gete(i)<<" ";
}
List.cpp
H:\PROGRAM FILES\VC6\MYPROJECTS\LESSON2\List\List.cpp(11) : error C2259: 'SqList<char>' : cannot instantiate abstract class due to following members: 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询