title: Inheriting vector class with different types
body: <p>I am trying to inherit STL vector class to create a new class on my own. It will use vector's base properties but i will add some new functions like sum or divide. The problem here is i am trying to implement that class also for different types. How can i use both inheritance and template at the same time ?</p>
  
  <p>Below is my class body where i need some help.</p>
  
  <pre><code>//template &lt;class T&gt; 
  ?
  class NewVector&lt;T&gt; : public vector&lt;T&gt;{
  
  //some constructors
  };
  </code></pre>
  
  <p>Yes. Inheriting STL is not a good idea. I am aware of it. But lets say i am using this inheritance.</p>
  
  <p>The problem i face here is building constructors.</p>
  
  <p>I am calling constructor in main like this,</p>
  
  <pre><code>NewVector&lt;int&gt; v1(3);
  </code></pre>
  
  <p>but the problem is i can not create this v1 vector like STL vector does. When i try to debug get 0 for size and 0 for capacity. How will i edit the size and capacity in constructor ? I tried to do those but couldn't manage.</p>
  
  <pre><code>template &lt;class T&gt; 
  class NewVector : public vector&lt;T&gt;{
  public:
  
  NewVector(T n){
  const ArithmeticVector&lt;T&gt; &amp;v1(n);
  cout&lt;&lt;v1.size()&lt;&lt;endl;
  
      };
  //some constructors
  };
  </code></pre>
  
  <p>i see the size of v1 vector 0, but i want to see it 3 as i mentioned. A little help would be nice.</p>
  
  <p>Here is the main file. i know i need to write some constructors but they need to work both int and double and also how will i tell my class to do them ?</p>
  
  <pre><code>using namespace std;
  int main() {
  
  NewVector&lt;int&gt; v1(3); // creating some objects
  NewVector&lt;int&gt; v2(3); // vector elements are assigned randomly from 0 to 10
  NewVector&lt;double&gt; v3(5);
  NewVector&lt;double&gt; v4(5);
  
  .....
  </code></pre>