using System; namespace NotePadTest{ interface IFactor{ IProduct CreateIProduct(); } interface IProduct{ void showMethod(); } class BaseProduct : IProduct{ public void showMethod(){ Console.Write(this.ToString()); Console.Read(); } } class ProductA : BaseProduct{ public new void showMethod(){ Console.Write(this.ToString() + "new"); Console.Read(); } } class ProductB : BaseProduct{ } class FactorA : IFactor{ public IProduct CreateIProduct(){ return new ProductA(); } } class FactorB : IFactor{ public IProduct CreateIProduct(){ return new ProductB(); } } class EntryPoint{ public static void Main(string[] args) { IFactor iFactor = new FactorA(); IProduct iProduct = (IProduct)iFactor.CreateIProduct(); iProduct.showMethod(); } } }