abstract class error

The program allows user to choose the implementation( Array-based or LikedList) and then test ADT member functions.

There are 3 files:
-ABCList.hpp
Abstract Data Class declaration with pure virtual functions (no private members)
-ABList.hpp
declaration and definition for Array-based implementation of the list (constructor, obviously few virtual functions)
-LinkedList.hpp
declaration and definition for Poiner-based implementation of the list (constructor, destructor, obviously few virtual functions)

main.cpp {
string input;
ABCList<string> * list;
list = new LinkedList<string>(); //1 error
...
delete list; //2 error
return 0;
}



1 error: "Allocating an object of abstract class type 'LinkedList".
2 error: "Delete called on 'ABCList<string>' that is abstract but has non-virtual destructor".

I have constructor for LinkedList, so the objects can be initialized.
Why does computer think LinkedList is an Abstract Data Type?
What can be the potential problem?
Last edited on
You have a pure virtual member function that's making your class abstract.

Because you don't have a virtual destructor, delete list; will not call `~LinkedList()' but only `~ABCList()'
Topic archived. No new replies allowed.