weird error message on dev-cpp
im using dev-cpp as my ide and when i try and compile my project that i'm working on it gives me the following error:
[Linker error] undefined reference to `vtable for ConsItem'
where consItem is a class in this form:
Code:
class ConsItem :
public Item {
public:
ConsItem(Item &acar, Item &acdr) : car(&acar), cdr(&acdr), Item(Cons) {};
virtual ~ConsItem() {};
virtual string toString(); //Turn the Cons item into a string
private:
Item *car;
Item *cdr;
};
and the testing code in main like this:
Code:
IntegerItem intitem(123);
StringItem stritem("rocks");
cout << stritem.toString() << endl;
cout << intitem.toString() << endl;
ConsItem consitem(intitem, stritem);
IntegerItem and StringItem and ConsItem all inherit from the same parent class called Item so I assume that i can pass them into ConsItem as Items, maybe i'm wrong? I was wondeirng if anyone else knew what this error means and how to fix it?