3 ms·
> Polymorphism allows you to do this. In the context of decorators, that usually means defining an interface. This doesn't work if you have a generic decorator
by dhotson 16y ago
> Polymorphism allows you to do this. In the context of decorators, that usually means defining an interface.
This doesn't work if you have a generic decorator class. You can't really make it implement all the interfaces you potentially want to use.
It's the same problem with mock objects in test cases. You can't pass them because the type check prevents it, even though in practice everything would work just fine.