Is it possible to have a base-class method designate a return-value of "the" derived class, and then create and return an instance of (or "relative to") whichever derived class it's called from?
Can this be done, or am I better off just using generics anyway?Code:abstract class Base { public static List<*DerivedClass*> BuildFromList(List<String> in_s) { List<*DerivedClass*> rv = new List<*DerivedClass*>(); foreach (String s in in_s) { rv.Add(new *DerivedClass*(s)); } } return rv; }
Thanks.




Reply With Quote