Originally Posted by
CornedBee
Absolutely delete it.
The problem is that you need an implementation of a destructor, even if it's pure. Easier to not make it pure, since you have a pure function already. (The only reason to make a destructor pure is
to make a class abstract when it has no natural pure functions.)
Code:
virtual ~GraphObj() {}
You don't need to explicitly create a destructor in any of the derived classes.
Aha!
I commented it out and it gave an error since line was private, so I made it protected.
And then the destructor stuff, so I have:
Code:
class GraphObj
{
public:
GraphObj(const string inputstr)
{
line = inputstr;
}
virtual ~GraphObj() {};
virtual void draw(Image& img) = 0;
protected:
string line;
};
Code:
class Line : public GraphObj
{
public:
Line(const string inputstr) : GraphObj(inputstr)
{
}
void draw(Image& img)
{
// stuff
}
};
No compile errors or warnings!!
Now, my constructor in Line is completely blank... Do I even need it? Looks odd...