title: Accessing a specific method of an inherited class in C++
body: <p>I come from Java background and I have the following little scenario that doesn't fit my understanding:</p>
  
  <pre><code>template&lt;typename T&gt;
  class GeomObject{
    public:
      T position;
  
      virtual Vec3&lt;T&gt; getPosition() = 0;
  }
  
  
  template&lt;typename T&gt;
  class Plane : public GeomObject&lt;T&gt; {
    public:
      Vec3&lt;T&gt; position;
      T range;
  
      Vec3&lt;T&gt; getPosition() { return position; }
      T getRange() { return range;}
  }
  </code></pre>
  
  <p>In my main:</p>
  
  <pre><code>vector&lt;GeomObject&lt;float&gt;*&gt; g_objects;
  g_objects.push_back(new Plane&lt;float&gt;());
  
  g_objects[0]-&gt;getRange(); //ERROR
  </code></pre>
  
  <p>I cannot access the getRange() method somehow. This was possible in Java but here is not, not even by casting <em>(Sphere)g_objects[0]->getRange();</em> I would like tho, to keep the vector as a vector of <em>GeomObjects</em> . Is there something I am doing wrong?</p>