c++ - A destructor - should I use delete or delete[]? -


I am writing a template class which takes input and stores it. Pointer means pointing to the allocated object of another class, and this class has been assigned to it.

Now I want to make a constructor for this container. What kind of memory should I point to through this indicator? I have no way of knowing the preference that it is an array or an element

I am new to C ++, so stay with me I have always used C, and Java like my oo Language, but between the desire to learn C ++ and the speed requirements of my project, I have gone with C ++

to convert the container into a container from a container to a container A better idea would be to have your own Can apply Ashk?

If you do not know whether it is new or new [] , then it is not safe to remove.

Your code may appear to work, for example, I work on a platform, the difference matters only when you have many objects that are destructors. So, you do this:

  // Fortunately, it works on my favorite platform. Do not do this - just one example why your code works ints = new Integer [20]; Delete Ints;  

But then you do this:

stder :: string * string = new std :: string [10]; Remove the wire;

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -