When I call the EntryPoint with a parameter of type TemplateA, I always receive an exception, since the first overload is always called.
What I expected to happen is that the most specific method (second overload) will be called due to dynamic binding.
Any ideas why?
private object _obj;
public void EntryPoint(object p)
{
myFunc(p);
}
//first overload
private void myFunc(object container)
{
throw new NotImplementedException();
}
//second overload
private void myFunc(TemplateA template)
{
_obj = new ObjTypeA(template);
}
//third overload
private void myFunc(TemplateB template)
{
_obj = new ObjTypeB(template);
}