What are the rules regarding function Overloading?
I have the following code:
public T genericFunc<T>() where T : Component, new()
{
T result = new T();
overloadedFunction( result );
}
private overloadedFunction ( Component c ) // catch all function
private overloadedFunction ( DerivedFromComponent dfc) // specific function
when I call the above code with:
genericFunc<DerivedFromComponent>();
I expect the more specific overloadedFunction to be called, however the catch all function is called instead, why is this?. When stepping through the above code the type T is indeed DerivedFromComponent, I thought that the CLR picked the best possible match at runtime!