All the data is being read correctly. The sphere constructor is working properly because I've run some tests where I create an object, push it in the vector, and in the same function call, read it from the vector and all the values are right.
This isn't the real code - it's just an abstraction of what I'm trying to do. Sorry if that's unclear.
Basically, I'm trying to determine if I need to do anything special for the vector I'm declaring in Scene. In the real code, I define other variables whose values are retained throughout the execution of my program.
However, for the Spheres vector, the Sphere object is only accurate within the function call where the Sphere is being created. So, for:
1 2 3 4 5 6 7 8
|
{
..
Sphere s(center,radius);
// s has correct values
scene.addSphere(s);
scene.getSphere();
//scene.getSphere() matches s
}
|
However, if I were to call getSphere() inside a different function, the sphere returned would NOT match the s that I placed at the beginning of the code.
Is there anything special that I need to do when I'm handling vectors inside of a class definition?