Asuming I have this two classes:
public class Threshold {
int min;
int max;
public virtual int calculate(int min, int max)
{
//calculate basic Threshold
}
}
public class AdvancedThreshold : Threshold {
int min;
int max;
int extra;
public override int calculate(int min, int max, int extra)
{
//calculate Advanced Threshold
}
}
I cannot do this, because the base method has two parameters whereas the subclass method has three parameters.
What would be the best design practice to approach this problem? is it possible to use polymorphic objects? do I need to use composite objects instead of inheritance?
I've read something similar to my problem here http://ift.tt/1KsVnSS
But I don't really understand the solution. Thank you.
Aucun commentaire:
Enregistrer un commentaire