Example #1
0
        public static void DoSomething(FatherClass f)
        {
            switch (f.Type)
            {
            case "FatherClass":
                f.Method();
                break;

            case "SonClass":
                ((SonClass)f).SonMethod();
                break;

            case "GrandsonClass":
                ((GrandsonClass)f).GrandsonMethod();
                break;
            }
        }
Example #2
0
 public static void DoSomething(FatherClass f)
 {
     switch (f.Type)
     {
         case "FatherClass":
             f.Method();
             break;
         case "SonClass":
             ((SonClass)f).SonMethod();
             break;
         case "GrandsonClass":
             ((GrandsonClass)f).GrandsonMethod();
             break;
     }
 }