I've been digging through several posts on this subject and could not find any suitable answer to the following problem…
can anyone tell me why this does not compile :
class MyItem {
public int ID;
}
class MyList<T> {
public List<T> ItemList;
}
class MyDerivedItem : MyItem {
public string Name;
}
class MyDerivedList<MyDerivedItem> : MyList<MyDerivedItem> {
public int GetID(int index) {
return ItemList[index].ID; // ERROR : MyDerivedItem does not contain a definition for ID
}
public string GetName(int index) {
return ItemList[index].Name; // ERROR : MyDerivedItem does not contain a definition for Name
}
}