I do not understand why this will not work at a technical level, but it violates the OOP polymorphism.
Why do you need to know if there is a car type? Could you define the methods of the abstract superclass ( Car
) and redefine them accordingly in the subclasses ( Cabriolet
and Pickup
)? Could you reorganize the hierarchy of cars so that the attributes of the subclasses become more general and transfer them to the attributes of the Car
, thereby eliminating the need for subclasses?
I had problems with NSFetchResultsController
when retrieving objects retrieved from a common superclass. (The returned objects can only be sorted / grouped by the attribute of the object. The class type is not an attribute, so it cannot be used to sort / group entities. My solution / hack was related to the type
attribute for the superclass - ugly, but it worked.)
source share