//program.cs
foreach (Mutant mutant in mutants)
{
label12.Text=mutant.displayInfo();
}
//Mutant.cs
public abstract int dangerQuotient();
public String displayInfo()
{
return(codename + " " + dangerQuotient().ToString());
}
//physicalMutant.cs
public override int dangerQuotient()
{
return level * IQ * strength;
}
//elementMutant.cs
public override int dangerQuotient()
{
return level * region;
}
Mutant is my base class and I have two derived classes physicalMutant and elementMutant. At final I'm getting the output for elementMutant class alone in label12. How to get output of physicalMutant too in the same label. By using message box control inside foreach loop i can get values from the displayQuotient() in both derived classes but by using label i can able to display only the last iteration value.How to overcome this problem?