static void Main()
A foo = new A();
If it compiles, then it can’t fail at runtime, right?
C# has got some extensions to make it "easier" to deal with legacy COM components (though I’m not sure I believe that). If an interface is marked with appropriate attributes then you’re allowed to use new on the interface type and the compiler will, behind the scenes, transform this instantiation into a construction of another class. The compiler has no problem with this class being unrelated to the interface that we started with.
public interface A
} public class Test
There’s some discussion of this here on Stack Overflow.