My first thought was to make a base class with the method defined as a no-op, and make them all inherit from it. Then I thought I could do this by checking if the class has implemented this method with can() before calling it, and skip the otherwise pointless inheritance. This method is only called from one place, so it wouldn't result in can() being strewn around everywhere.
Still leaning toward the first way, but I'm curious which of these sounds better to other OO coders. Does the can() approach sound evil?
In reply to OO design: abstract class or can()? by perrin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |