title: Difference between using .ipp extension and .cpp extension files
body: <p>Suppose I have 2 header files, 1 .ipp extension file and a main.cpp file:</p>
  <p>First header file <strong>myClass1.h</strong> (like interface in Java):</p>
  <pre><code>template&lt;class T&gt;
  class myClass1{
      public:
          virtual int size() = 0;
  };
  </code></pre>
  <p>second header file <strong>myClass2.h</strong>:</p>
  <pre><code>#include &quot;myClass1.h&quot;
  template&lt;class T&gt;
  class myClass2 : public myClass1&lt;T&gt;{
       public:
            virtual int size();
       private:
           int numItems;
  };        
  #include &quot;myClass2.ipp&quot;
  </code></pre>
  <p>And then is my <strong>myClass2.ipp</strong> file:</p>
  <pre><code>template &lt;class T&gt;
  int myClass2&lt;T&gt;::size()
  {    
    return numItems;
  }
  </code></pre>
  <p>Last one is my <strong>main.cpp</strong>:</p>
  <pre><code>#include &quot;myclass2.h&quot;
  void tester()
  {
    myClass2&lt;int&gt; ForTesting;
    if(ForTesting.size() == 0)
    {
      //......
    } 
    else 
    {
     //.....
    }
  }
  
  int main(){
     tester();
     return 0;
  }
  </code></pre>
  <p>myClass1, myClass2 and myClass2.ipp belong to header file. main.cpp in source file.
  What's the advantages by using this way to implement your program instead of using just
  .h and .cpp files? And what is .ipp extension file? The difference between .ipp and .cpp?</p>