title: Count.h:10:5: error: ISO C++ forbids declaration of 'T' with no type [-fpermissive] T(); ^
body: <p>I'm having trouble compiling my first project using template classes, getting errors all stemming from my template classes, including:</p>
  
  <pre><code>In file included from CountArray.h:1:0,
               from Executive.h:2,
               from main.cpp:3:
  Count.h:10:5: error: ISO C++ forbids declaration of 'T' with no type [-fpermissive]
     T();
       ^
  Count.h:10:3: error: declaration of 'int Count&lt;T&gt;::T()'
     T();
     ^
  Count.h:4:11: error:  shadows template parm 'class T'
   template &lt;typename T&gt;
             ^
  Count.h:11:4: error: typedef-name 'T' used as destructor declarator
     ~T();
      ^
  Count.h:11:6: error: declaration of '~T' as member of 'Count&lt;T&gt;'
     ~T();
        ^
  Count.h:12:3: error: 'T' does not name a type
     T getItem();
     ^
  </code></pre>
  
  <p>And others from the like. I have two template classes, </p>
  
  <pre><code>template &lt;typename T&gt;
  Count&lt;T&gt;::T(){
  item=new Count&lt;T&gt;;
  count=1;
  }  
  
  template &lt;typename T&gt;
  Count&lt;T&gt;::~T(){
  delete item;
  }
  
  template &lt;typename T&gt;
  //needs type declaration, error for it being T type
  T Count&lt;T&gt;::getItem(){
  return item;
  }
  
  template&lt;typename T&gt;
  void Count&lt;T&gt;::setCount(){
  count++;
  }
  
  template &lt;typename T&gt;
  int Count&lt;T&gt;::getCount(){
      return count;
  }
  </code></pre>
  
  <p>and another which has the header file</p>
  
  <pre><code>#include "Count.h"
  #ifndef COUNTARRAY_H
  #define COUNTARRAY_H
  template &lt;typename T&gt;
  class CountArray{
  private:
      Count&lt;T&gt;* array;
      int arraySize; // initially: 10
      int numItemsStored=0;
  public:
      CountArray();
      CountArray(const CountArray&lt;T&gt;&amp; countArr);
      ~CountArray();
  
      void bumpCount(T t);
      int getNumItemsStored() const;
      Count&lt;T&gt; getItem(int whichItem) const;
      int getCount(int whichItem) const;
      void print();
      int setArraySize(int size);
      int getArraySize();
      void doubleArraySize();
  };
  
  #include "CountArray.cpp"
  #endif
  </code></pre>
  
  <p>Which has instances called by Executive:</p>
  
  <pre><code>#include &lt;fstream&gt;
  #include "CountArray.h"
  
  class Executive{
  private:
      CountArray&lt;char&gt; charArray;
      CountArray&lt;int&gt; intArray;
      CountArray&lt;std::string&gt; strArray;
  
      template &lt;typename T&gt;
      static void print(CountArray&lt;T&gt; arr); // arr MUST be passed by value
  
      template &lt;typename T&gt;
      static void read(std::istream&amp; is, CountArray&lt;T&gt;&amp; arr);
  
  public:
      Executive(std::istream&amp; charFile, std::istream&amp; intFile,
                std::istream&amp; stringFile);
  
      void print() const;
  };
  </code></pre>
  
  <p>and then the main file:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include "Executive.h"
  
  //Get file names
  int main(int argc, char* argv[]){
  
  std::ifstream charFin, intFin, stringFin;
  
  //open file, check if open, then continue if so.
  charFin.open(argv[1]);
  if(charFin.is_open()){
      argv[1].read(charFin, charArray);
  }
  else{
      std::cout &lt;&lt;"Unable to open " &lt;&lt;argv[1] &lt;&lt;std::endl;
      return -1;
  }
  
  intFin.open(argv[2]);
  if(intFin.is_open()){
      argv[2].read(intFin, intArray);
  }
  else{
      std::cout &lt;&lt;"Unable to open " &lt;&lt;argv[2] &lt;&lt;std::endl;
      return -1;  
  }
  
  stringFin.open(argv[3]);
  if(stringFin.is_open()){
      argv[3].read(stringFin, strArray);
  }
  else{
      std::cout &lt;&lt;"Unable to open " &lt;&lt;argv[3] &lt;&lt;std::endl;
      return -1;
  }
  Executive exec(charFin, intFin, stringFin);
  exec.print();
  return 0;
  }
  </code></pre>
  
  <p>I don't know where or how to fix these errors, but I know they're related to the templates and I understand this is a very narrow-seeming question but I hope it can help others having similar errors, seeing as they all have the same rooting problem.</p>