vendredi 21 décembre 2018

Object oriented design. What better?

I have a Printer class that should print a number and text. The number never changes for each Client class. I have more Client objects with different number values.

What design is better?

In the sample1 the number sends to print() method as argument, therefore all Client objects use single Print object. In the sample2 the number sends to the Printer constructor, therefore each Client object have own Printer object.

Please help me figure it out.

UML diagram

Aucun commentaire:

Enregistrer un commentaire