Polymorphism and overloading with static methods in C#.
问题 I have been trying to generate a Factory supposed to return a different object of a common interface (say Item ) according to the input parameter (I call it a context) of the function getItem(A context) Now, assume I define a new type of context: B which inherits from A . I wanted to return a different item depending on whether the object passed to the factory was of class B or A . I tried to do as follows (overloading the method): class Factory { static Item getItem(A context) {...} static