title: Class Design Problems (managing memory allocation & deallocation)
body: <p>1) So i have made a somewhat modified form of linked list that has indexed based addressing and other delete functions. I am just gonna copy the header file i made...</p>
  
  <pre><code> template&lt;class T&gt;
      class LinkedList
      {
          public:
            LinkedList();
           ~LinkedList();
            int del_node();  // deletes the Node and element
            int remove_node();  // deletes the Node only
            int get_length();   
            int search_node(T*); // matches the pointer to see if its the same element
            void add(T*);
            void clear_list(); // calls deletes on all nodes and all elements
            bool is_blank(); 
            T&amp; get_at(int);      // operates like a vector get_at
  private:
        struct Node
        {
          T* element;  // pointer passed to add(T*) is stored here.
          Node* next;
       }
  </code></pre>
  
  <p>Now see how i am adding an object in a linked list. I need to pass in an object pointer which i am passing in the form of</p>
  
  <p><code>new Object()</code></p>
  
  <p>This is particularly useful when i am adding Vertices of a graph. I just input the data and other fields from the user and call </p>
  
  <pre><code>LinkedList graph
  graph.add(new Vertex(arguments));
  </code></pre>
  
  <p>Now there comes a situation when i have to copy some elements from the <code>LinkedList</code> <code>A</code> to <code>B</code> for temporary storage. Now i want to be able to remove elements from <code>B</code> after any kind of operation. But if i use <code>delete</code> it destroys the internal Node and deletes the object pointed by the pointer <code>element</code> i passed to it. So i created an additional function <code>remove</code> that only deletes the Node but not the object pointed by the <code>element</code>.</p>
  
  <p>So i wanted to ask if its okay to do this or is there a design fault in my list and i should not be doing this? I am thinking of this from a library point of view for example if i would go about providing this class in a library. Is this suitable or will this confuse people? Any advice would be appreciated.</p>
  
  <blockquote>
    <p>Please, I don't need any suggestions to use a replacement
    function/class/library like vector. I am studying Data Structures and i have
    to design any sort of data structure myself.</p>
  </blockquote>