jeudi 25 juillet 2019

How should we implement constructor code when using the Decorator Pattern if each decorator needs different arguments?

I am working on a C# project, and I was planning on using the Decorator pattern.

Basically, we have to keep track of machine computer servers. Machine computer Servers.

enter image description here A Machine computer Server could be a Worker Or A Machine computer Server could be a Master

A Master will have a List workersList;

A Worker will have a MasterDecorator master;

Could someone please show me how to implement the constructors for the aforementioned decorators in such a way -that I could supply the MasterDecorator entity during the constructor instantiating? -that I could supply the List collection entity during the constructor instantiating?

Aucun commentaire:

Enregistrer un commentaire