I was wondering what is the best practice re. passing (another class) amongst two instances of the same class (lets call this Primary ). So, essentially in the constructor for the first, i can initialize the outside instance (lets call this Shared ) - and then set it to a particular value whilst im processing this class in main().
So Shared , may be an int, say 999 by now.
Now what if i create another instance of the main class Primary ? whats the best way to access the already initialized outside instance of Shared - because if i don t handle this correctly, the constructor for Primary , when called again will just go ahead and create one more instance of Shared , and thus i loose the value 999.. i can think of some messy solutions involving dynamic pointers and if statements (just) but i have a feeling there might be a simpler, cleaner solution?