static void Main(string[] args) { Console.WriteLine("enter your object type"); var x = Console.ReadLine(); I1 obj = CreateObj.getObject(x); Console.WriteLine(obj.getID()); Console.WriteLine(obj.getName()); Console.ReadKey(); }