Advertisement
Advertisement
| 07.17.2008 at 10:14AM PDT, ID: 23574062 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: |
List<baseType> myList = new List<baseType>();
myList.Add(someChild1);
myList.Add(someChild2);
foreach(myClass my in myClassList)
{
foreach(baseType b in myList)
{
b.DoSomething(common1, common2, my.different1);
b.DoSomething(common1, common2, my.different2);
b.DoSomething(common1, common2, my.different3);
}
}
//////
abstract class baseType<T>
{
public abstract void DoSomething(common1, common2, List<T>);
}
//////
class someChild1 : baseType<different1>
{
public override void DoSomething(common1, common2, different1){...}
}
class someChild2 : baseType<different2>
{
public override void DoSomething(common1, common2, different2){...}
}
|