No. The calls generated by the compiler are to the members it knows about at compile-time. That's the members exposed by ObjectA
.
Any reason you're not using normal inheritance, with virtual/overridden methods?
Here's another example of the same kind of thing, by the way - the overloaded == operator for strings isn't used, even though T
is string
in the call to Foo
:
using System;
class Test
{
static bool Foo<T>(T first, T second)
where T : class
{
return first == second;
}
static void Main()
{
string x = "hello";
string y = new string(x.ToCharArray());
Console.WriteLine(Foo(x, y));
}
}