Here is the problem: I keep getting the unimplemented pure virtual method error when trying to compile. I have implemented all of the pure virtual methods in the abstract base class. Any ideas?
here is the abstract base class:
class record{
public:
virtual int getID()=0;
virtual record *clone();
};
and the implementation:
class sdata: public record{
public:
sdata(std::string s = ""){data=s; ID=atoi(data.substr(0,8).c_str());}
virtual int getID(){return ID;}
private:
std::string data;
int ID;
};
sorry, here is the complete error message:
Unimplemented pure virtual method 'getID' in 'record'
Perhaps this bit of code is causing the error then:
int hashTable::hash(record *x) {
return floor(m * (x->getID() * A - floor(x->getID() * A)));
}
override
to the declaration ofgetID
in the derived class and see what happens. – Striverecord
instead ofdata
. Could you post the code where you use the class? – Leatrioverride
is non-standard, though. – Leatri