title: class T in c++ (your definition)
body: <p>The one advantage of using class T in c++ is to reduce the time to redefine data types in a function, if those data types are defined in other function, for example, in int main.</p>
  
  <pre><code>template &lt;class T&gt;
  void showabs(T number)
  {
    if (number &lt; 0 )
      number  = -number;
    cout &lt;&lt; number &lt;&lt; endl;
    return 0;
  }
  
  int main()
  {
    int num1 = -4;
    float num2 = -4.23f;
  
    showabs(num1);
    showabs(num2);
  
    return 0;
  }
  </code></pre>
  
  <p>So in this case, without class T, for each data type, we have to add its corresponding data-type condition, that is, another set of if statement for int, and another one for float.</p>
  
  <p>Am I correct?</p>