关于接口,我遇到了以下代码示例。为什么这个类在 main 方法中实例化自己的对象?它是 C# 和 Java 中的有效理论或代码约定吗?(编译器没有抱怨..但我很好奇)
using System;
interface IParentInterface
{
    void ParentInterfaceMethod();
}
interface IMyInterface : IParentInterface
{
    void MethodToImplement();
}
class InterfaceImplementer : IMyInterface
{
    static void Main()
    {
        InterfaceImplementer iImp = new InterfaceImplementer();
        iImp.MethodToImplement();
        iImp.ParentInterfaceMethod();
    }
    public void MethodToImplement()
    {
        Console.WriteLine("MethodToImplement() called.");
    }
    public void ParentInterfaceMethod()
    {
        Console.WriteLine("ParentInterfaceMethod() called.");
    }
}