I would like to ask you some opinion about what I'm doing. I know it works, but I'm not sure is proper to do what I'm doing.
I have a superclass Building that need to expose two NSString, name and description. No one should be able to modify those variables apart their subclasses.
To get this result I have created two public method on the base class:
@interface Building : NSObject
- (NSString *)name;
- (NSString *)description;
@end
Then on each subclass I'm creating a private interface with name and description properties and let the magic happen.
@interface Barrack()
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *description;
@end
@implementation Barrack
@synthesize name, description;
...
@end
What you guys think about this?Is this a proper way to get this kind of result, anyone have better ideas about this topic? Thanks for your opinion.
Best,
Enrico