Before you tell me that there is already a similar question, yes, i know, I've read it. But the question there focuses on when, I'm interested in why.
I get how the things work. The classic animal,dog,cat example always works like a charm.
The thing is this code
int main()
{
Cat c;
Sound theSound;
c.letsDo(&theSound);
}
seems so unnatural to me. Why?
I mean, yeah, this way I have my Dog and Cat models undifferentiated (first time I ever use that word in english btw) because the real implentation is hidden under the Sound class but isn't that just a way to weigh down your code? Isn't polymorphism enough to do something like this?
To me the difference is that with polymorphism you have to edit each class (but the model stays the same, right?) whereas you have just to edit one class with the visitor design pattern.