Since you can't put properties into a c# interface, how do you expose each classes public properties when consuming the class as an interace instance?
interface iAnimal
{
   bool Load(int Id);
   bool Save();
}
class Fish : iAnimal
{
   private string description;
   public string Description
   {
        get { return this.description; }
        set { this.description = value; }
   }
   public bool Load(int Id)
   {
       ...
   }
   public bool Save()
   {
       ...
   }
}
class Dog : iAnimal
{
   private string description;
   private string hypernessLevel;
   public string Description
   {
        get { return this.description; }
        set { this.description = value; }
   }
   public string hypernessLevel
   {
        get { return this.hypernessLevel; }
        set { this.hypernessLevel = value; }
   }
   public bool Load(int Id)
   {
       ...
   }
   public bool Save()
   {
       ...
   }
}
iAnimal animal;
Switch (TypeOfAnimal)
{
   case "Fish":
     animal = new Fish();
       break;
   case "Dog":
     animal = new Dog();
       break;
}
txtDescription.Text = animal.Description //How would you expose description and dog's hpernessLeve?
Software/Hardware used:
VS 2005, C#
ASKED:
February 23, 2010 5:55 PM
UPDATED:
February 24, 2010 10:18 PM
Yes, I have used casting to do what your last sentence said.