I would like to ask if that implementation of classes Genotypes
and Individual
violates the Dependency Inversion Principle? If so, how to fix that?
Here is the code:
public interface IGenotype
{
//some code...
}
public abstract class AIndividual
{
// ... some code
public IGenotype Genotype { get; set;} // DIP likes that !
}
public class Individual : AIndividual
{
public Individual()
{
// some code ...
this.Genotype = new Genotype(); // Is this ok in case of DIP?
}
}
public class Genotype : IGenotype
{
// ... some code
}