Which is best way to store objects?

J

James Kanze

The contact record does exist and a class managing the contact
record must keep track of the state of the record, it is not
read-only. For example, if a user changes the contact record
a notification of the change is received. Like the bank
account, we do not want to edit a copy of the contact on the
stack. So on this basis contact has reference semantics?
Agree?

That's what it sounds like. My example was, of course, overly
simple, and the issues may be more complex, but in general, if
you're modifying a record in different places, the type of the
record should generally have identity, i.e. not be assignable or
copiable.
In addition, due to the fact that we only want to maintain one
copy of each contact, we should disable copying and access the
individual objects via reference?

Exactly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top