纯虚函数重载的错误:cannot instantiate abstract class due to following members
最近在看一本书《数据结构与算法——面向对象的C++设计模式》 里面用类模板的形式讲解了栈,然后在实例化使用的时候碰到了如标题所示的问题,实在找不出问题的原因。只能上来求助了,代码较长。。就发到资源那里了,是整个工程。
源代码:
http://download.csdn.net/source/3227340
下面是错误提示:
:\myfjdthink\dsexp5\datatem\test.cpp(8) : error C2259: 'StackAsArray' : cannot instantiate abstract class due to following members:
d:\myfjdthink\dsexp5\datatem\stack_queue.h(25) : see declaration of 'StackAsArray'
d:\myfjdthink\dsexp5\datatem\test.cpp(8) : warning C4259: 'int __thiscall Object::CompareTo(const class Object &) const' : pure virtual function was not defined
d:\myfjdthink\dsexp5\datatem\container_iterator.h(16) : see declaration of 'CompareTo'
d:\myfjdthink\dsexp5\datatem\test.cpp(8) : error C2259: 'StackAsArray' : cannot instantiate abstract class due to following members:
d:\myfjdthink\dsexp5\datatem\stack_queue.h(25) : see declaration of 'StackAsArray'
d:\myfjdthink\dsexp5\datatem\test.cpp(8) : warning C4259: 'int __thiscall Object::CompareTo(const class Object &) const' : pure virtual function was not defined
d:\myfjdthink\dsexp5\datatem\container_iterator.h(16) : see declaration of 'CompareTo'
d:\myfjdthink\dsexp5\datatem\container_iterator.h(127) : error C2872: 'ostream' : ambiguous symbol
d:\myfjdthink\dsexp5\datatem\test.cpp(9) : see reference to class template instantiation 'Wrapper<int>' being compiled
Error executing cl.exe.
DataTem.exe - 3 error(s), 0 warning(s)