mercredi 15 juillet 2020

How is registered in the object of the parameter of the constructor?

public class MuestraEstadistica implements Observer,ElementoDespliegue{
    DatoDelTiempo datoTiempo; 
    public  MuestraEstadistica(DatoDelTiempo datoTiempo) { 
        this.datoTiempo=datoTiempo; 
        this.datoTiempo.registerObserver(this) ;
    }

I can't understand why in the running of the program, the method registerObserver(this) registers the object in the object received in the parameter of the constructor, instead of being received by the object declared in the class because when I call the method registerObserver I put this. at first of all with that I mean the object of the class. Please someone explain to me.

Aucun commentaire:

Enregistrer un commentaire