title: Print value in array using template class-c++
body: <p>Hi I'' trying to make a template for a class to print out values in an array. </p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  template &lt;typename T&gt;
  class Array{
     public:
        Array(T array[], int arraysize){
           size=arraysize;
           _array=new T[size];
        }
  
        ~Array(){
           delete[] _array;
        }
        void print(){
           for(int i=0; i&lt;size; i++){
              cout&lt;&lt;_array[i]&lt;&lt;' ';
           }
        }
        private:
           T *_array;
           int size;
  };
  
  int main(){
     int array1[5]={1,2,3,4,5};
     Array&lt;int&gt; a(array1,5);
     a.print();
  
     float array2[5]={1.012, 2.324, 3.141, 4.221, 5.327};
     Array&lt;float&gt; b(array2,5);
     b.print();
  
     string array3[]={"Ch1","Ch2","Ch3","Ch4","Ch5"};
     Array&lt;string&gt; c(array3,5);
     c.print();
  
     return 0;
  
  }
  </code></pre>
  
  <p>This is the code and I was wondering what's wrong because it would print out random numbers. </p>