views:

9

answers:

0

Let's say I have an inheritance hierarchy as follows:

Device <- EthernetDevice <- WirelessDevice

So a Wireless device is a subclass of EthernetDevice, which is a subclass of Device.

Ok, so if a user creates a Device object and the user later decides that it's actually a Wireless device, how do I change the object's type? At the moment I'm creating a new WirelessDevice managed object and essentially moving through each property of the Device object and assigning it to the same property of the WirelessDevice object. Then telling the ManagedObjectContext to delete the Device object. Is this the easiest way? Is there a form of typecasting or a copy style method that also notifies the ManagedObjectContext of the change?

Thanks