+ 1

Communcation between objects

how would you advise i implement communication of data from one object to another. ex: I have a class A. I instantiate many objects A1, A2,.... Ax. I'd like A1 to send a value to some other An. (I'd rather not use a third party container object) thanks in advance

3rd Mar 2017, 1:58 PM
Clém Grt
Clém Grt - avatar
4 Réponses
+ 1
An.receiveInfo(A1.getData())
3rd Mar 2017, 2:11 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
not in my solution, it implies that An has a method to receive A1's data and A1 has a method to give this data
3rd Mar 2017, 5:05 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
use the "baptiste's" method or like this.. An.result=A1.calcresult
3rd Mar 2017, 2:30 PM
ibrahim selman
0
but it implies that each An got a pointer to A1, isn't it?
3rd Mar 2017, 3:45 PM
Clém Grt
Clém Grt - avatar