jeudi 12 mars 2015

Accessing methods of Observable class in Observer class

How do you access a method/instance from an Observable class in an Observer class where the method/instance is not the object being observed.


For example, if these getter methods were in my Observable class but only book was being observed, how would I access name and store in my Observer class (namely in the update() method)?



public class MethodEx extends Observable {
...
public String getName(){
return this.name;
}

public String getBook(){
return this.book;
}

public String getStore(){
return this.store;
}
}

Aucun commentaire:

Enregistrer un commentaire