I\'m facing with the following design problem:
TL;TD need to determine if Hero(class) can use specific object while there\'s many heroes implementations
I have
I'm thinking about using Visitor Pattern.
Something like:
Hero * h;
Item * i;
Visitor v;
// Assign some values
h.accept(v,i);
Then the visitor looks like:
visit(sword *p, warrior * w){
w.use(p);
}
visit(wand *p, wizard * w){
w.use(p);
}
visit(bow *p, archer * w){
w.use(p);
}
Any suggestions regard to this idea?