Implementing a "state-machine" logic for methods required by an object in C++
Posted
by
user827992
on Programmers
See other posts from Programmers
or by user827992
Published on 2012-06-22T19:27:38Z
Indexed on
2012/06/22
21:25 UTC
Read the original article
Hit count: 449
What I have: 1 hypothetical object/class + other classes and related methods that gives me functionality.
What I want:
- linking this object to 0 to N methods in realtime on request when an event is triggered
- Each event is related to a single method or a class, so a single event does not necessarily mean "connect this 1 method only" but can also mean "connect all the methods from that class or a group of methods"
- Avoiding linked lists because I have to browse the entire list to know what methods are linked, because this does not ensure me that the linked methods are kept in a particular order (let's say an alphabetic order by their names or classes), and also because this involve a massive amount of pointers usage.
Example:
I have an object Employee Jon
, Jon acquires knowledge and forgets things pretty easily, so his skills may vary during a period of time, I'm responsible for what Jon can add or remove from his CV, how can I implement this logic?
© Programmers or respective owner