Even though technically there is nothing wrong on deriving Article from Word, an article would probably contain words, not be a word. It would make more sense if you had something like:
Code:
class Text
{
public:
vector<Word> words; //this is an array of objects of class Word
...
Text();
};
class Article : Text
{
};
Thus an article will be a Text, where a Text will contain a vector (an array) of Word's.
Don't really know what lasersight means with "type code". But I would say it doesn't matter. It is not superfluous. Why? Because category is private. Article cannot use it anyways. If you wanted Article to use lemma but not category, since category makes no sense for an article, you should have:
Code:
class Word {
public:
Word();
...
protected:
string lemma;
private:
string category;
};
It could be superfuous if you really really care about the object's memory and you don't want it to have an extra string w/o a reason. Then you would have to make a basicWord class. Same as word without category. Word would derive from basicWord as well as Article. But most of the times these are details. You shouldn't go into a lot of trouble, wasting time, just to avoid having an unused by the derived class member.