vendredi 21 septembre 2018

Callback vs object reference

Design question: Suppose we have parent and child object. Sometimes child object says "Parent, you've got to update your state." So, is there any critical difference between

  1. Passing parent object reference into child contructor

and

  1. Passing parent object callBack function into child constructor

of course, Except the case when child has to be revoked any chance to affect parent object other than using this callBack function.

Aucun commentaire:

Enregistrer un commentaire