jeudi 23 janvier 2020

Inheritance depending on calculated attribute

I am curently working on a small project (C#) where I have data to analyse. To do so, I pass the data into the constructor of a class.

The class makes a first analysis on the data, and a certain value is determined using the data. Using this value I can say that this data is of Type B, C, D, ... and the analysis would continue in another class corresponding to the data type.

This would be it's class diagram representation :

enter image description here

So the "Data" Class should abstract but not really ? ¯\_(ツ)_/¯

I did some reasearch about the factory design pattern, but I think this is not really what I am trying to achieve. Is there maybe an other design pattern that does what I want to do?

Thank you for helping.

Aucun commentaire:

Enregistrer un commentaire