I'm writing a simple rpg game to get some practice in C# and i got a problem. I can't get access to a child parameter while im using foreach. Is there a way not to use two different lists for each type and remain on list with base type?
class A{}
class B : A{public int hp=5}
class C : A{public int hp=10}
List<A> d = new List();
d.Add(new B());
d.Add(new C());
foreach(A a in d){
a.hp--; //does not see 'hp'
}