This is super-useful for the project I'm working on since it allows
me to keep all my data together.
However, now I have a situation where I need NSPanel to have these
members as well. So I wrapped up my @interface in a macro:
This works great. However, from a code design perspective, it seems
sloppy to me. I don't like having to rely on macros.
In other languages, I could use multiple inheritance, e.g. if this
were C++ I could do this:
struct MyWindowExtensions {
int stuff;
MyObject * moreStuff;
};
class MyWindow : public NSWindow, public MyWindowExtensions {};
class MyPanel : public NSPanel, public MyWindowExtensions {};
But ObjC doesn't support multiple inheritance.
I've run up against this problem with views as well, and I've managed
to get some mileage out of categories, but there are a lot of
situations where you just need to add members.
So what is the best design pattern for something like this? Anything
nicer than a good old fashioned #define?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com