ios - How to have two NSManagedObject classes with the same superclass -
i have 2 classes, mammals , fish, both inherit general superclass, animals. i'd store mammals , fish using core data, i've made them both subclasses of nsmanagedobject. so, when want mammals , fish, execute couple fetch requests.
my question animals superclass.
- it's properties , methods used 2 subclasses, should nsmanagedobject well?
- if so,
mammals,fishneed explicit nsmanagedobject subclass because subclassanimals? - is approach flawed?
sorry if super-basic question, if answer "yes; no." 1 of answers here warned against using inheritance in data model, hence apprehension.
make own decision whether inheritance model tie in knots in future. in direct answer question inheritance tree like...
nsmanagedobject -> animal -> mammals -> fish so
@interface animal : nsmanagedobject
and
@interface fish : animal
just wary core-data not take complex rearrangement if need upgrade model in future , still hang on existing data. not impossible, not easy.
Comments
Post a Comment