|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- template<class T>
- class maxPriorityQueue{
- public:
- virtual ~maxPriorityQueue(){}
- virtual bool empty() const =0;
- virtual int size()const =0;
- virtual const T& top()=0;
- virtual void pop() =0;
- virtual void push(const T& theElement) =0;
- };
- template<class T>
- class ArrayMaxPriorityQueue:public arrayList<T>,public maxPriorityQueue<T>{//无序线性表
-
- public:
- const T& top();
- void pop();
- void push(const T& theElement);
- };
复制代码
实例化时为啥会报错呢
- int main(){
-
- ArrayMaxPriorityQueue<int> b();
- b.top();
- //
-
- return 0;
-
- }
复制代码
request for member 'top' in 'b', which is of non-class type 'ArrayMaxPriorityQueue<int>()'
请求“b”中的成员“top”,该成员属于非类类型“ArrayMapriotyQueue<int>()” 这句话啥意思
基类和派生的 方法都定义了
我这派生的能自动调用基类的构造函数吗
|
|