in reply to initializing objects from values from a db
Another, possibly better way to ask my question -- how do I create an object a part of which (its data) is shared with other objects without requiring making a copy of that data?Save the recurring data in an (anonymous) variable and store a reference to that variable in your object. But don't forget to dereference the reference if you need to access the data!
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: initializing objects from values from a db
by punkish (Priest) on Dec 05, 2009 at 20:29 UTC |