Is it possible to add a single category to multiple objects?
I have a set of classes which I want to add a "toString" method to but they are in no way related so it feels wrong to subclass just to add this one method and there's just too many classes to simply add the method to each and every one of them.
I know I could just create another class which would do this on any object but the method implementation is going to vary a great deal from object to object.
I have a set of classes which I want to add a "toString" method to but they are in no way related so it feels wrong to subclass just to add this one method and there's just too many classes to simply add the method to each and every one of them.
I know I could just create another class which would do this on any object but the method implementation is going to vary a great deal from object to object.