Hello,
I need help to properly write my model: I want to define a body, made of body parts.
rem: Not being an IT person, I may go a wrong direction
I guess that creating one subclass per body part is just wrong. There's so much of them - moreover the subclasses wouldn't have an added value (no specific behavior needed).
I read about "typedef enum", which allows me to list "constants". I'm trying to use this with a custom "constructor":
However, I've not found how to pass an item from my typedef at construct time.
I read on forums to "use the language, don't fight with it". Maybe my approach is just wrong.
Please help and provide me with some guidance!
I need help to properly write my model: I want to define a body, made of body parts.
rem: Not being an IT person, I may go a wrong direction
I guess that creating one subclass per body part is just wrong. There's so much of them - moreover the subclasses wouldn't have an added value (no specific behavior needed).
I read about "typedef enum", which allows me to list "constants". I'm trying to use this with a custom "constructor":
Code:
#imports (...)
typedef enum bodyParts {
HEAD, HAND_LEFT, THUMB_LEFT, FINGER2_LEFT, (...), LUNG_LEFT, (...)
} bodyParts;
@interface BodyPart : NSObject {
BodyPart *parentBodyPart;
(...)
}
[INDENT]- (BodyPart*) initWithType:(???)part;[/INDENT]
@end
However, I've not found how to pass an item from my typedef at construct time.
I read on forums to "use the language, don't fight with it". Maybe my approach is just wrong.
Please help and provide me with some guidance!