windows - C++ Can not create instance of abstract class -
i have following class:
(header)
struct udtmapping { int bytestart; int bytecount; int ihpunitid; }; class clsmapping : public cbasestructure { private: vector<udtmapping> m_content; protected: public: vector<udtmapping> &content(); void add(int i1, int i2, int int3); };
cpp file:
vector<udtmapping> &clsmapping::content() { return m_content; } void clsmapping::add(int i1, int i2,int i3) { udtmapping n; n.bytestart = i1; n.bytecount = i2; n.ihpunitid = i3; m_content.push_back(n); return; }
now wanted use class saying
clsmapping nmapping;
but compiler tells me "can not create instance abstract class".
i not sure went wrong. thank help.
edit: on request here cbasestructure
class cbasestructure { protected: virtual void processtxtline(string line) = 0; virtual void afterload(); virtual string compactline(string line); public: void load(string file); void load2(string file); void load3(string file); };
cbasestructure must abstract class. if want derive , want non-abstract class must override each pure virtual function cbasestructure declares. didn't that.
edit
cbasestructure has 1 pure virtual function processtxtline
. class must override function.
there nothing in code explains why inheriting cbasestructure, thing you?
Comments
Post a Comment