I have a method that returns an object of type Bucket:
Bucket Dispense(string typeName);
I have a class with a name Widgetthat subclasses Bucket:
public class Widget : Bucket { }
I want to do this:
Widget w = Controller.Dispense('widget');
I think this is possible given that a Widgetis Bucket. I could use the return type Dispense(string)for input Widget, but I would rather do it without a cast. Is there a way to smooth types Bucketand Widget?
source
share