It is possible to have a type in the parent class that the subclass overwrites?
The idea here would be to have a shape class, with subclasses of rectangles, square, circles, etc. Wondering if it's possible to overwrite the definition of 'shapeType' int property in the parent class. Something like this?
e.g. in globals.h
#define kShapeType_Rectangle = 1
#define kShapeType_Square = 2
#define kShapeType_Triskaidecagon = 13 // try pronouncing this!
in shape.h
@interface shape : NSObject
@property int shapeType;
@property int shapeID;
@property UIColor shapeColor;
@end
....
in rectangle.h
#import globals.h
@interface rectangle : shape
@property static (nonatomic, readonly) int shapeType = kShapeType_Rectangle; // how do I get this working?
@end
So two questions:
1) Is such a thing possible - i.e. redeclaration of parent property as a static variable
2) Yes or No to (1), is this the best coding style for this sort of thing? I'm not experienced in Obj-C patterns, but if one exists, could someone suggest a source for me to look at please?
Thanks a lot!