It's, I think somethin basic in OOP :
Environment : C#/.net 2.0
Let's say I have two class :
public class Animal
{
}
public class Dog : Animal
{
}
A service class with two method :
 public void DoStuff(Animal animal)
    {
        Console.Write("Animal stuff");
    }
    public void DoStuff(Dog animal)
    {
        Console.Write("Dog stuff");
    }
If I execute the following code :
 Animal instance = new Animal();
        MyService.DoStuff(instance);
        Animal instance2 = new Dog();
        MyService.DoStuff(instance2);
"Animal stuff" is printed twice.
So my question is : why ? And how can I get "Animal stuff" and "Dog stuff" without casting instance2, or moving the method from my service to my class (in fact I would like that my code works, but it's not :()
Thanks
PS : These are just example :)
Because the Visitor pattern is not really appealing, I'll just move my service's method to my class, waiting for a better solution.
 
     
     
    