C# Class Factories
- by Andy
I have a class called Foo that has a function that looks like the following
List<Bar> LoadData();
Both Foo and Bar are in a library that I want to reuse in other projects. Now I am working on a new project and I want to subclass Bar. Let's call it NewBar.
What is a simple and flexible way to get Foo.LoadData to return a list of NewBar? I think that a factory is needed or perhaps just a delegate function. Can anyone provide an example?
Thanks, Andy