New answers tagged

0

In your particular example the memento doesn't really serve any purpose (or, at least, the reasons for having it aren't obvious). If you had a more complicated internal state that you didn't want to expose to clients, but you still needed a way for them to temporarily hold on to that state, then Memento helps. Simultaneously, you can have getters and setters ...


3

It's always possible There are lots of work-arounds to implement multi-methods in languages that don't support them: Some use dispatch tables. The most impressing is imho in Alexandrescu's Modern C++ Design where template magic is used to make it happen almost naturally... provided that you're very versed in template programming. Some hijack the build-in ...


2

This is basically a fundamentally impossible problem: The fundamental idea of multiple dispatch is that all arguments that take part in the dispatch are equal, i.e. that there is no argument which is "special". So, if you don't want a "special" argument, then you only have two choices: you either have privileged access to no arguments, or ...


Top 50 recent answers are included