return an interface or a class csharp

Code Example - return an interface or a class csharp

                
                        // The return of interface as an instance of that interface
// Ff the instance has a few instances then no need to worry about the type of instance
// This example returns an object that has implemented Ic
public interface Ic
{
    int Type { get; }
    string Name { get; }
}

public class A : Ic
{
}

public class B : Ic
{
}

public Ic func(bool flag)
{
     if (flag)
         return new A();
       return new B();

}