static void PrintPensionAmount(PublicServant servant) { if (servant is Firefighter) Console.WriteLine("Pension of firefighter: " + servant.PensionAmount); else if (servant is PoliceOfficer) Console.WriteLine("Pension of officer: " + servant.PensionAmount); }
static void PrintPensionAmount(PublicServant servant) { if (servant is Firefighter) { Console.WriteLine("Pension of firefighter: " + servant.PensionAmount); } else if (servant is PoliceOfficer) { Console.WriteLine("Pension of officer: " + servant.PensionAmount); } }