I found some code where derivation from a base class is used as a kind of flag to mark some objects as belonging to a specific group:
// Base type for any item to be stored in a Storage.
class Item { // trivial class (as shown here)
public:
virtual ~Item() {}
};
class BaseItem; // complex class
class ItemA : public BaseItem, public Item; // complex class
class Storage;
Since there already is a base class to derive from, we get multiple inheritance.
Is this a good way to proceed, considering the cost in terms of performance of multiple inheritance, and the fact that this code must be efficient?
Could a simple flag be a better option?