dimanche 24 avril 2016

Java : how to use the observer design pattern to update all instances of a class

So I have a film class that has the data members : id, name, genre, type, and price.

Is it possible for me to use the observer design pattern to update the price of all these films. So i want to select an option to add the promotion all the films to be half price for customers. I am able to do this normally but have to try use some design patterns for this project.

Update/** Sorry if I wasn't clear. I want to know if I can use the observer design pattern to update the price of all the film instances of my Film Class. So when the staff member signs into the system he has the option to add a film promotion. So when he selects "All Films Half Price" it will update all the instances of the film class with the new price.

I'm not sure if this is even possible with the observer but I have to use some design patterns in this project and thought that I could make use of the observer here

**/

Any help on the matter would be greatly appreciated!

Aucun commentaire:

Enregistrer un commentaire