• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Core Data Subentities and Subclasses
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data Subentities and Subclasses


  • Subject: Core Data Subentities and Subclasses
  • From: Jonathon Mah <email@hidden>
  • Date: Tue, 10 Jan 2006 12:59:56 +1030

Hi all,

I'm having trouble understanding the relationship between Core Data entity inheritance and class inheritance. I couldn't find any documentation about it (on ADC or the list archives), so I did some investigating and thought I should share the results.

For example, let's say there are four entities. (For clarity, entities will be named EThing, and classes CThing.) ECar and ETruck have EVehicle as their parent entity. EFerrari has ECar as its parent entity.

     EVehicle
   (name, color)
     /        \
   ECar       ETruck
 (topGear)  (wheelCount)
    |
 EFerrari
(topSpeed)

Now, EVehicle has its class set to CVehicle, a direct subclass of NSManagedObject. I put together some questions and knocked up a test app to try them out. Some I have answered myself.

Q1. Must ECar and ETruck's classes be a kind of CVehicle?
A1. No. It can be NSManagedObject, or a direct subclass of NSManagedObject (e.g. CCar, or even CVehicle).


Q2. If ECar has its class set to NSManagedObject and I change its name, will that call the -setName: method of CVehicle?
A2. No. It will only do so if ECar's class is set to a kind of CVehicle.


Q3. Is it "bad style" to have entity inheritance structured differently to class inheritance?


Jonathon Mah email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Core Data Subentities and Subclasses
      • From: Miguel Sanchez <email@hidden>
  • Prev by Date: [MEET] Next CocoaHeads Coming Up
  • Next by Date: Silencing beeps from nonexistent key equivalents
  • Previous by thread: [MEET] CocoaHeads/Mac dev group: MacWorld
  • Next by thread: Re: Core Data Subentities and Subclasses
  • Index(es):
    • Date
    • Thread