I am having a problem with pointers (I think). I have "(1)" an instance of a data class, and "(2)" a pointer to a data class (the same data class that "(1)" is an instance of). This data class is build up of a variety of things (lets say; a few "doubles" and a few "data classes" and a few "pointers").
Question1: How do I get a copy of what "(2)" is holding, stored into "(1)"?
(should I just create an update function that does something like: storage.x = ptr_storage->x; )?
Question2: If I am working with pointers to classes does this work?
Code:DataClass storage; // an instance of the data class
DataClass *ptr_storage; // a pointer to the data class
...
storage.initialize();
ptr_storage = new DataClass();
...
// pretend there is code here that spawns off a thread, and continually updates "ptr_storage" with new data
...
for loop{
storage = *ptr_storage; // DOES This give me a seperate and "deep" copy of the data object that ptr_storage is pointing too?
....
}