Say I have a class like so:
class Foo{
Foo* otherFooObj;
Foo* otherFooObj2;
.....
};
Would it better to:
A.
- Acquire the correct values for member variables (addresses for
otherFooObj
andotherFooObj2
, etc.) using functions - Instantiate (construct) a Foo object with those correct values.
- Push the object to a vector.
OR
B.
- Instantiate a Foo object with dummy values (dummy addresses for
otherFooObj
andotherFooObj2
) - Push the object to a vector.
- Use functions to set the Foo object's member variables to correct values once it sits inside the vector.
OR
C.
- Instantiate a Foo object with dummy values
- Use functions to acquire correct values and set Foo's member variables to those values
- Push the object to a vector.
Right now, I'm thinking there isn't much difference between any of these design patterns, and that it doesn't matter which flow I follow. But I would like to get more opinions on this, and want to know if there are any other factors I'm overlooking and I should consider (which I feel like there are, maybe with pointers and such).