Skip to main content

Timeline for Confusion about inheritance

Current License: CC BY-SA 3.0

4 events
when toggle format what by license comment
Nov 11, 2013 at 14:43 comment added Zan Lynx @SamuelAdam: This sounds like a problem with your data store. If SQL use a transaction to safely delete and reinsert the object. Or depending on how it works force it to load ID 1 into a Member object instead of the default Customer. And your in memory objects should allow making a copy. So copy construct a Member from a Customer then write that back to the data store.
Nov 11, 2013 at 6:32 review First posts
Nov 11, 2013 at 7:30
Nov 11, 2013 at 6:29 comment added Samuel Adam I did this before, but stumbled on entity continuity issue. Say we created a Customer object with Id = 1. When we wanted to upgrade the that customer to a member, the code says we needed to create a new object of type Member even though it derived from Customer. Creating a member with Id = 1 would be wrong, because a Customer with that Id is already existed. Deleting the previous Customer object before seems kind of risky..
Nov 11, 2013 at 6:14 history answered frogmanx CC BY-SA 3.0