lundi 16 novembre 2020

What's the best way to design a state machine with different object inheritance

I have a class A and class B, both derive from the same parent class. Each object has a state machine inside it that defines it's behaviour. The behaviour is different though depending on if the object is of a class A or B. My approach to this is to differentiate what class an object is in the state machine and behave accordingly. Is there a better way to do this?

Aucun commentaire:

Enregistrer un commentaire