Design question?

Hi,
I am wondering if this is a good design for my player class

1
2
3
4
5
6
7
8
9
class Player : public GameObject, public Stats, public Talkable
{
  void process()
  {
    GameObject::process();
    Stats::process();
    Talkable::process();
  }
}


So you extend the different classes based on what you want it to do. If you want it to be able to talk you extend the talkable class. If it is going to have health ect then you extend the stats class?

Good design or bad design? If its a bad design please give a more appropriate way of doing it

Thanks,
Dan
No. You'll find multiple inheritance of implementation will be an ongoing and increasingly anoying problem.

I immediately take it all back. It depends on what GameObject, Stats and Talkable are. If GameObject is a concrete type and the other two are interfaces (abstract base classes) then it may be ok. But if they're all concrete classes, you're asking for trouble.
Topic archived. No new replies allowed.