How to Create & Store objects into a Vector dynamically

Pages: 12
SO THERE IS NO ADVANTAGE OF DOING IT WITH A POINTER just loosing ime with symbols??

What will be the diference
Sometimes you need to use pointers. But if you don't need them, you may as well avoid them.
Yes i know, to Arrays and mallocs but
When will u need them at the specific, if you still can allocate dynamicaly "at the vector's back" and if u still can delete dynamically eith no problem again "at the vector's back"
Last edited on
When you need pointers:
_ You don't have the ownership of the objects, but you are referencing them.
_ You want to use polymorphism
_ The class doesn't have a copy constructor (maybe the new standard have something to say about this)
Agreed. If you don't need pointers, don't use them. Let the container do the work for you.
Thanks you very much all of you. Solved. We've given answer to a vital element which however wasnt reachable anywhere on the web by the most common search terms someone can Imagine.

May the thread its colsed and archived, and your articles on vectors be updated.

TAGS : CREATE OBJECTS STORE VECTOR DYNAMICALLY CLASS HISTANTANATION HISTANCE POINTERS NEW
Topic archived. No new replies allowed.
Pages: 12