Using templated "super"
<p>Related question: <a href="http://stackoverflow.com/questions/180601/using-super-in-c">Using "super" in C++</a></p>

<p>I examined the source code for <a href="http://opensteer.sourceforge.net/" rel="nofollow">OpenSteer</a> and found the following code for defining properties of vehicles. The requirement is Super have too be inherited from an interface class AbstractVehicle.</p>

<pre><code>template &lt;class Super&gt;
class SteerLibraryMixin : public Super { ... }

template &lt;class Super&gt;
class AnnotationMixin: public Super { ... }

template &lt;class Super&gt;
class LocalSpaceMixin: public Super { ... }
</code></pre>

<p>With these I could define a SimpleVehicle with all properties:</p>

<pre><code>// SimpleVehicle_1 adds concrete LocalSpace methods to AbstractVehicle
typedef LocalSpaceMixin&lt;AbstractVehicle&gt; SimpleVehicle_1;


// SimpleVehicle_2 adds concrete annotation methods to SimpleVehicle_1
typedef AnnotationMixin&lt;SimpleVehicle_1&gt; SimpleVehicle_2;


// SimpleVehicle_3 adds concrete steering methods to SimpleVehicle_2
typedef SteerLibraryMixin&lt;SimpleVehicle_2&gt; SimpleVehicle_3;


// SimpleVehicle adds concrete vehicle methods to SimpleVehicle_3
class SimpleVehicle : public SimpleVehicle_3 { ... }
</code></pre>

<p>Or just with one of the properties:</p>

<pre><code>class SimpleVehicle : public LocalSpaceMixin&lt;AbstractVehicle&gt; { ... }
</code></pre>

<p>This was pretty smart, here I could choose what properties my vehicles should have but when I tried to compile it it didn't work!</p>

<p>Compiler errors:</p>

<p><pre><code>SteerLibrary.hpp||In member function <code>Vec2D SteerLibrary&lt;Super&gt;::SteerForWander(float)':|
SteerLibrary.hpp|41|error: there are no arguments to </code>GetMaxSpeed' that depend on a template parameter, so a declaration of <code>GetMaxSpeed' must be available|
SteerLibrary.hpp|41|error: (if you use </code>-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)|
SteerLibrary.hpp|42|error: there are no arguments to <code>GetVel' that depend on a template parameter, so a declaration of </code>GetVel' must be available|</pre></code></p>

<p>Here I'm trying to access my AbstractVehicle member function 'GetMaxSpeed' and 'GetVel'.
With '-fpermissive' it compiles and work but it issues a warning for every member function and with good reason - one could pretty easily inherit from a non AbstractVehicle with none of these functions!</p>

<p>Now for my question: Is this a better way to handle this? I tried with the typedef method like the link above but it didn't work at all.</p>
