The CustomerAccount class has a "CanHave" relationship with Investment.
In your CustomerAccount class, create a collection of Investments. You could use a list to achieve this:
List<Investment> _investments;
Don't forget to initialize the list in your constructor.
_investments = new List<Investment>();
Edit:
Looping through the list:
foreach Investment invst in _investments
{
if (invst.GetType() == typeof(Stock)) { }
else if (invst.GetType() == typeof(MutualFund)) { }
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…