I have a class C and a method f. I want f to behave differently for a few instances.
For example, if my class is Animal and f is printing "I'm a" and the animal name, I'd like :
cat.f() prints "I'm a cat"
dog.f() prints "I'm a dog"
puma.f() prints "I'm a BIG puma"
The behavior of f change for puma. And it could be much different than just a word. I could use derived classes but it seems heavy for such a thing. What's the cleanest way to do it ?