title: Design classes for "two-dimension"-like expansion by inheritance
body: <p>I'd like to make two base classes (e.g. figure and move) with some children for each one(cube, sphere and so on for figure; shift, rotate, rescale and so on for moves). Initial number of figures and moves is unknown - it must be expandable. Each move should know how to move each figure, so having N figures and M moves means to have N*M function for them. (Adding a move requires creation of N functions for each already existing figure and adding figure requires creation of M functions for each already existing move). </p>
  
  <p>The question is how to declare theese functions? For example, I'll have a class Set containing list of figures (aka vector) and I need to ask this class to move all the figures by i-th move. Probably set would have a method of </p>
  
  <pre><code>set::move_all (const move&amp; ) 
  </code></pre>
  
  <p>and... well what next? The easiest idea is to create virtual method </p>
  
  <pre><code>class figure { 
      ...
      virtual void move_this (const move&amp; ) 
      ...
  }
  </code></pre>
  
  <p>to call a virtual method move_figure</p>
  
  <pre><code>class figure_i: public figure {
      ...    
      virtual void move_this (const move&amp; M)
         {M.move_figure(*this);
         }  
      ... 
  }
  
  class move {
      ...
      template &lt;class T&gt; virtual void move_figure (T&amp;) const
      ...
  }
  </code></pre>
  
  <p>and specialize it for each i-th move like this</p>
  
  <pre><code>template &lt;&gt; void shift::move_figure &lt;cube&gt; (cube&amp; C)
      {
      }
  </code></pre>
  
  <p>and so on, but virtual templates are illegal. </p>