title: how to make a queue whose template argument is an abstract base class?
body: <p>My program needs a FIFO queue to hold all of these events going. These events should be of different user-defined types, but the queue needs one template parameter. So I figured that I would use an abstract base class. Additionally, this also has the benefit of forcing the derived classes to have the function signatures I want. </p>
  
  <p>However, when I try the following, I inspect elements of the queue via <code>std::queue::front</code>, but it doesn't let me call virtual functions of these elements. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;queue&gt;
  
  class Base
  {
  public:
      virtual double returnNum() {};
  };
  
  class InfoChunk : public Base
  {
  private:
      double m_num;
  public:
      InfoChunk(const double&amp; arg) : m_num(arg) {};
      double returnNum() {return m_num;};
  };
  
  int main(int argc, char **argv)
  {
  
      std::queue&lt;Base&gt; q;
      InfoChunk info(.2);
      q.push(info);
      while(!q.empty()){
          std::cout &lt;&lt; q.front().returnNum() &lt;&lt; "\n";
          q.pop();
      }    
  
      return 0;
  }
  </code></pre>
  
  <p>This all compiles, but it prints <code>0</code> instead of <code>.2</code>. What's the deal here?</p>