how to implement this observer pattern?
- by lethal
Hello. I have 4 classes, that describe state diagram. Node, Edge, ComponentOfNode, ComponentOfEdge.
ComponentOfEdge compounds from ComponentsOfNode. Node can have 0..n outgoing edges. Edge can have only 2 nodes.
Edge should be able to offer ComponentOfNode, but only from nodes that Edge has, in form ComponentOfEdge.
The user can change ComponentsOfNode. I need this change spreads to all Edge. Hw to do it? I expect the observer should be used.
Can you give me example in pseudocode please?