ICreature hores = Factory.CreateHorse()
internal abstract class Creature { public virtual void Walk() { } public virtual void Run() { } public virtual void Swim() { } } public interface ICreature { void Walk(); void Run(); void Swim(); } internal class Tiger : Creature, ICreature { } internal class Horse : Creature, ICreature { public override void Walk() { throw new Exception("Can walk"); } } internal class Fish : Creature, ICreature { public override void Walk() { throw new Exception("Can walk"); } public override void Run() { throw new Exception("Can Run"); } } internal class Tortoise : Creature, ICreature { public override void Run() { throw new Exception("Can Run"); } } public static class Factory { public static ICreature CreateTiger() { return new Tiger(); } public static ICreature CreateHorse() { return new Horse(); } public static ICreature CreateFish() { return new Fish(); } public static ICreature CreateTortoise() { return new Tortoise(); } }
Command="{Binding CheckCommand,Mode=TwoWay}"