Ok so I want to know if i were to set the following function to run when i press a key on the keyboard, would it run and stack the object in the vector? and would I be able to access it outside the function afterwards. also would the newObject be usable if i was pushing it on the stack one after another after i keep pressing the key that runs the function. I am trying to create a stack of objects that are unique so I can have several different object i create every time i press the key. so i need to know how does the scope work for vectors and class objects in this manor. could some one please explain how this works or how i might approach this problem.